Skip to content

Commit 132ba7a

Browse files
committed
Merge branch 'for-7.1/block' into for-next
* for-7.1/block: blk-iocost: fix busy_level reset when no IOs complete
2 parents 208cd44 + f91ffe8 commit 132ba7a

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

block/blk-iocost.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,8 @@ static enum hrtimer_restart iocg_waitq_timer_fn(struct hrtimer *timer)
15961596
return HRTIMER_NORESTART;
15971597
}
15981598

1599-
static void ioc_lat_stat(struct ioc *ioc, u32 *missed_ppm_ar, u32 *rq_wait_pct_p)
1599+
static void ioc_lat_stat(struct ioc *ioc, u32 *missed_ppm_ar, u32 *rq_wait_pct_p,
1600+
u32 *nr_done)
16001601
{
16011602
u32 nr_met[2] = { };
16021603
u32 nr_missed[2] = { };
@@ -1633,6 +1634,8 @@ static void ioc_lat_stat(struct ioc *ioc, u32 *missed_ppm_ar, u32 *rq_wait_pct_p
16331634

16341635
*rq_wait_pct_p = div64_u64(rq_wait_ns * 100,
16351636
ioc->period_us * NSEC_PER_USEC);
1637+
1638+
*nr_done = nr_met[READ] + nr_met[WRITE] + nr_missed[READ] + nr_missed[WRITE];
16361639
}
16371640

16381641
/* was iocg idle this period? */
@@ -2250,12 +2253,12 @@ static void ioc_timer_fn(struct timer_list *timer)
22502253
u64 usage_us_sum = 0;
22512254
u32 ppm_rthr;
22522255
u32 ppm_wthr;
2253-
u32 missed_ppm[2], rq_wait_pct;
2256+
u32 missed_ppm[2], rq_wait_pct, nr_done;
22542257
u64 period_vtime;
22552258
int prev_busy_level;
22562259

22572260
/* how were the latencies during the period? */
2258-
ioc_lat_stat(ioc, missed_ppm, &rq_wait_pct);
2261+
ioc_lat_stat(ioc, missed_ppm, &rq_wait_pct, &nr_done);
22592262

22602263
/* take care of active iocgs */
22612264
spin_lock_irq(&ioc->lock);
@@ -2397,9 +2400,17 @@ static void ioc_timer_fn(struct timer_list *timer)
23972400
* and should increase vtime rate.
23982401
*/
23992402
prev_busy_level = ioc->busy_level;
2400-
if (rq_wait_pct > RQ_WAIT_BUSY_PCT ||
2401-
missed_ppm[READ] > ppm_rthr ||
2402-
missed_ppm[WRITE] > ppm_wthr) {
2403+
if (!nr_done && nr_lagging) {
2404+
/*
2405+
* When there are lagging IOs but no completions, we don't
2406+
* know if the IO latency will meet the QoS targets. The
2407+
* disk might be saturated or not. We should not reset
2408+
* busy_level to 0 (which would prevent vrate from scaling
2409+
* up or down), but rather to keep it unchanged.
2410+
*/
2411+
} else if (rq_wait_pct > RQ_WAIT_BUSY_PCT ||
2412+
missed_ppm[READ] > ppm_rthr ||
2413+
missed_ppm[WRITE] > ppm_wthr) {
24032414
/* clearly missing QoS targets, slow down vrate */
24042415
ioc->busy_level = max(ioc->busy_level, 0);
24052416
ioc->busy_level++;

0 commit comments

Comments
 (0)