37
37
enum wbt_flags {
38
38
WBT_TRACKED = 1 , /* write, tracked for throttling */
39
39
WBT_READ = 2 , /* read */
40
- WBT_KSWAPD = 4 , /* write, from kswapd */
40
+ WBT_SWAP = 4 , /* write, from swap_writepage() */
41
41
WBT_DISCARD = 8 , /* discard */
42
42
43
43
WBT_NR_BITS = 4 , /* number of bits */
44
44
};
45
45
46
46
enum {
47
47
WBT_RWQ_BG = 0 ,
48
- WBT_RWQ_KSWAPD ,
48
+ WBT_RWQ_SWAP ,
49
49
WBT_RWQ_DISCARD ,
50
50
WBT_NUM_RWQ ,
51
51
};
@@ -172,8 +172,8 @@ static bool wb_recent_wait(struct rq_wb *rwb)
172
172
static inline struct rq_wait * get_rq_wait (struct rq_wb * rwb ,
173
173
enum wbt_flags wb_acct )
174
174
{
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 ];
177
177
else if (wb_acct & WBT_DISCARD )
178
178
return & rwb -> rq_wait [WBT_RWQ_DISCARD ];
179
179
@@ -528,7 +528,7 @@ static bool close_io(struct rq_wb *rwb)
528
528
time_before (now , rwb -> last_comp + HZ / 10 );
529
529
}
530
530
531
- #define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO)
531
+ #define REQ_HIPRIO (REQ_SYNC | REQ_META | REQ_PRIO | REQ_SWAP )
532
532
533
533
static inline unsigned int get_limit (struct rq_wb * rwb , blk_opf_t opf )
534
534
{
@@ -539,13 +539,13 @@ static inline unsigned int get_limit(struct rq_wb *rwb, blk_opf_t opf)
539
539
540
540
/*
541
541
* 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
543
543
* it's WB_SYNC_ALL writeback, and we'll use the max limit for
544
544
* that. If the write is marked as a background write, then use
545
545
* the idle limit, or go to normal if we haven't had competing
546
546
* IO for a bit.
547
547
*/
548
- if ((opf & REQ_HIPRIO ) || wb_recent_wait (rwb ) || current_is_kswapd () )
548
+ if ((opf & REQ_HIPRIO ) || wb_recent_wait (rwb ))
549
549
limit = rwb -> rq_depth .max_depth ;
550
550
else if ((opf & REQ_BACKGROUND ) || close_io (rwb )) {
551
551
/*
@@ -622,8 +622,8 @@ static enum wbt_flags bio_to_wbt_flags(struct rq_wb *rwb, struct bio *bio)
622
622
if (bio_op (bio ) == REQ_OP_READ ) {
623
623
flags = WBT_READ ;
624
624
} 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 ;
627
627
if (bio_op (bio ) == REQ_OP_DISCARD )
628
628
flags |= WBT_DISCARD ;
629
629
flags |= WBT_TRACKED ;
0 commit comments