summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@linux.dev>2026-08-14 09:56:37 -0700
committerJens Axboe <axboe@kernel.dk>2026-08-15 17:15:08 -0600
commit8935bf22c0a0db517a7f72f7097300e05dd852f5 (patch)
treec53d839a9711cc47d095e8051584e27fb4c3eb8c /block
parent7fab47863aa2a1680415bd73b7e0a4212a2ebf0e (diff)
downloadlinux-8935bf22c0a0db517a7f72f7097300e05dd852f5.tar.gz
linux-8935bf22c0a0db517a7f72f7097300e05dd852f5.zip
blk-iolatency: clear delay state when freeing policy data
io.latency can throttle a group which has no latency target of its own. When a sibling misses its target, check_scale_change() scales down its peers, and a peer that reaches queue depth one gets blkcg_use_delay() called on it on every further scale-down, even with min_lat_nsec == 0. iolatency_pd_offline() resets the target through iolatency_set_min_lat_nsec(), which clears the delay only on a nonzero to zero transition, so it never clears such a peer. Freeing the policy data then leaves blkg->use_delay set and blkcg->congestion_count elevated with nothing left that can drop it. blk_cgroup_congested() then returns true for every task in that cgroup and its descendants for as long as the cgroup lives: page_cache_sync_ra() cuts readahead to a single page, page_cache_async_ra() skips it altogether, and __folio_throttle_swaprate() takes swap_avail_lock and schedules a throttle on anonymous folio allocation. Clear the delay in iolatency_pd_free(). By then bio-held blkg references have drained, or the queue is frozen for policy deactivation, so check_scale_change() cannot re-arm it. The free callback can also see policy data which was never attached to a blkg, hence the pd->blkg check. Fixes: d70675121546 ("block: introduce blk-iolatency io controller") Signed-off-by: Usama Arif <usama.arif@linux.dev> Acked-by: Tejun Heo <tj@kernel.org> Link: https://patch.msgid.link/20260814165712.510132-2-usama.arif@linux.dev Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-iolatency.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c
index 9eb69010c34e..2caa79a008ad 100644
--- a/block/blk-iolatency.c
+++ b/block/blk-iolatency.c
@@ -1043,6 +1043,15 @@ static void iolat_release(struct rcu_head *rcu)
static void iolatency_pd_free(struct blkg_policy_data *pd)
{
+ struct blkcg_gq *blkg = pd_to_blkg(pd);
+
+ /*
+ * Groups throttled as collateral have min_lat_nsec == 0, so
+ * iolatency_pd_offline() leaves their delay set. Drop it here, where
+ * no in-flight bio can re-arm it via check_scale_change().
+ */
+ if (blkg)
+ blkcg_clear_delay(blkg);
call_rcu(&pd->rcu_head, iolat_release);
}