Skip to content

Commit 8c936f9

Browse files
htejunaxboe
authored andcommitted
iocost: don't reset the inuse weight of under-weighted debtors
When an iocg is in debt, its inuse weight is owned by debt handling and should stay at 1. This invariant was broken when determining the amount of surpluses at the beginning of donation calculation - when an iocg's hierarchical weight is too low, the iocg is excluded from donation calculation and its inuse is reset to its active regardless of its indebtedness, triggering warnings like the following: WARNING: CPU: 5 PID: 0 at block/blk-iocost.c:1416 iocg_kick_waitq+0x392/0x3a0 ... RIP: 0010:iocg_kick_waitq+0x392/0x3a0 Code: 00 00 be ff ff ff ff 48 89 4d a8 e8 98 b2 70 00 48 8b 4d a8 85 c0 0f 85 4a fe ff ff 0f 0b e9 43 fe ff ff 0f 0b e9 4d fe ff ff <0f> 0b e9 50 fe ff ff e8 a2 ae 70 00 66 90 0f 1f 44 00 00 55 48 89 RSP: 0018:ffffc90000200d08 EFLAGS: 00010016 ... <IRQ> ioc_timer_fn+0x2e0/0x1470 call_timer_fn+0xa1/0x2c0 ... As this happens only when an iocg's hierarchical weight is negligible, its impact likely is limited to triggering the warnings. Fix it by skipping resetting inuse of under-weighted debtors. Signed-off-by: Tejun Heo <[email protected]> Reported-by: Rik van Riel <[email protected]> Fixes: c421a3e ("blk-iocost: revamp debt handling") Cc: [email protected] # v5.10+ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9dca416 commit 8c936f9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

block/blk-iocost.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2322,7 +2322,17 @@ static void ioc_timer_fn(struct timer_list *timer)
23222322
iocg->hweight_donating = hwa;
23232323
iocg->hweight_after_donation = new_hwi;
23242324
list_add(&iocg->surplus_list, &surpluses);
2325-
} else {
2325+
} else if (!iocg->abs_vdebt) {
2326+
/*
2327+
* @iocg doesn't have enough to donate. Reset
2328+
* its inuse to active.
2329+
*
2330+
* Don't reset debtors as their inuse's are
2331+
* owned by debt handling. This shouldn't affect
2332+
* donation calculuation in any meaningful way
2333+
* as @iocg doesn't have a meaningful amount of
2334+
* share anyway.
2335+
*/
23262336
TRACE_IOCG_PATH(inuse_shortage, iocg, &now,
23272337
iocg->inuse, iocg->active,
23282338
iocg->hweight_inuse, new_hwi);

0 commit comments

Comments
 (0)