3737enum wbt_flags {
3838 WBT_TRACKED = 1 , /* write, tracked for throttling */
3939 WBT_READ = 2 , /* read */
40- WBT_KSWAPD = 4 , /* write, from kswapd */
40+ WBT_SWAP = 4 , /* write, from swap_writepage() */
4141 WBT_DISCARD = 8 , /* discard */
4242
4343 WBT_NR_BITS = 4 , /* number of bits */
4444};
4545
4646enum {
4747 WBT_RWQ_BG = 0 ,
48- WBT_RWQ_KSWAPD ,
48+ WBT_RWQ_SWAP ,
4949 WBT_RWQ_DISCARD ,
5050 WBT_NUM_RWQ ,
5151};
@@ -172,8 +172,8 @@ static bool wb_recent_wait(struct rq_wb *rwb)
172172static inline struct rq_wait * get_rq_wait (struct rq_wb * rwb ,
173173 enum wbt_flags wb_acct )
174174{
175- if (wb_acct & WBT_KSWAPD )
176- return & rwb -> rq_wait [WBT_RWQ_KSWAPD ];
175+ if (wb_acct & WBT_SWAP )
176+ return & rwb -> rq_wait [WBT_RWQ_SWAP ];
177177 else if (wb_acct & WBT_DISCARD )
178178 return & rwb -> rq_wait [WBT_RWQ_DISCARD ];
179179
@@ -528,7 +528,7 @@ static bool close_io(struct rq_wb *rwb)
528528 time_before (now , rwb -> last_comp + HZ / 10 );
529529}
530530
531- #define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO)
531+ #define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO | REQ_SWAP )
532532
533533static inline unsigned int get_limit (struct rq_wb * rwb , blk_opf_t opf )
534534{
@@ -539,13 +539,13 @@ static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
539539
540540 /*
541541 * At this point we know it's a buffered write. If this is
542- * kswapd trying to free memory, or REQ_SYNC is set, then
542+ * swap trying to free memory, or REQ_SYNC is set, then
543543 * it's WB_SYNC_ALL writeback, and we'll use the max limit for
544544 * that. If the write is marked as a background write, then use
545545 * the idle limit, or go to normal if we haven't had competing
546546 * IO for a bit.
547547 */
548- if ((opf & REQ_HIPRIO ) || wb_recent_wait (rwb ) || current_is_kswapd () )
548+ if ((opf & REQ_HIPRIO ) || wb_recent_wait (rwb ))
549549 limit = rwb -> rq_depth .max_depth ;
550550 else if ((opf & REQ_BACKGROUND ) || close_io (rwb )) {
551551 /*
@@ -622,8 +622,8 @@ static enum wbt_flags bio_to_wbt_flags(struct rq_wb *rwb, struct bio *bio)
622622 if (bio_op (bio ) == REQ_OP_READ ) {
623623 flags = WBT_READ ;
624624 } else if (wbt_should_throttle (bio )) {
625- if (current_is_kswapd () )
626- flags |= WBT_KSWAPD ;
625+ if (bio -> bi_opf & REQ_SWAP )
626+ flags |= WBT_SWAP ;
627627 if (bio_op (bio ) == REQ_OP_DISCARD )
628628 flags |= WBT_DISCARD ;
629629 flags |= WBT_TRACKED ;
0 commit comments