Skip to content

blk-cgroup: remove queue_lock nesting from blkcg paths

Yu Kuai cgroups linux-block linux-mm lkml 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/8blk-cgroup: protect iterating blkgs with blkcg->lock in blkcg_print_stat()block/blk-cgroup.c+3 -60 replies
2/8blk-cgroup: delay freeing policy data after rcu grace periodblock/bfq-cgroup.c block/blk-cgroup.h block/blk-iocost.c +2 more+42 -60 replies
3/8blk-cgroup: don't nest queue_lock under rcu in blkcg_print_blkgs()block/bfq-cgroup.c block/blk-cgroup-rwstat.c block/blk-cgroup.c +2 more+34 -250 replies
4/8blk-cgroup: don't nest queue_lock under rcu in blkg_lookup_create()block/blk-cgroup.c+36 -210 replies
5/8blk-cgroup: don't nest queue_lock under rcu in bio_associate_blkg()block/blk-cgroup.c+11 -70 replies
6/8blk-cgroup: don't nest queue_lock under blkcg->lock in blkcg_destroy_blkgs()block/blk-cgroup.c+26 -190 replies
7/8mm/page_io: don't nest queue_lock under rcu in bio_associate_blkg_from_page()mm/page_io.c+6 -10 replies
8/8block, bfq: don't grab queue_lock to initialize bfqblock/bfq-iosched.c+0 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] blk-cgroup: remove queue_lock nesting from blkcg paths

From: Yu Kuai <[email protected]>

Hi,

This series is the follow-up blk-cgroup locking cleanup on top of the earlier blkg-list protection fixes, and prepares blk-cgroup to stop using q->queue_lock as the global blkg lifetime/iteration lock.

The current queue_lock based protection is hard to maintain because queue_lock is used from hardirq and softirq completion paths, while some blkcg cgroup file paths also need to iterate blkgs, print policy data, or create blkgs from RCU-protected contexts. This series first tightens the blkcg-side lifetime rules:

- blkcg_print_stat() iterates blkgs under blkcg->lock with IRQs disabled.
- policy data freeing is delayed past an RCU grace period.
- blkcg_print_blkgs(), blkg lookup/create, bio association, page-IO association, blkg destruction, and BFQ initialization stop nesting queue_lock under RCU or blkcg->lock.

Using blkcg->lock and RCU for blkcg-owned lists/data keeps the lock order local to blk-cgroup and avoids extending queue_lock into cgroup file iteration paths. It also makes the subsequent conversion to q->blkcg_mutex possible without carrying forward queue_lock's interrupt-context constraints.

Yu Kuai (8):
blk-cgroup: protect iterating blkgs with blkcg->lock in
blkcg_print_stat()
blk-cgroup: delay freeing policy data after rcu grace period
blk-cgroup: don't nest queue_lock under rcu in blkcg_print_blkgs()
blk-cgroup: don't nest queue_lock under rcu in blkg_lookup_create()
blk-cgroup: don't nest queue_lock under rcu in bio_associate_blkg()
blk-cgroup: don't nest queue_lock under blkcg->lock in
blkcg_destroy_blkgs()
mm/page_io: don't nest queue_lock under rcu in
bio_associate_blkg_from_page()
block, bfq: don't grab queue_lock to initialize bfq

 block/bfq-cgroup.c        |  17 ++++-
 block/bfq-iosched.c       |   5 --
 block/blk-cgroup-rwstat.c |  15 ++--
 block/blk-cgroup.c        | 151 ++++++++++++++++++++++----------------
 block/blk-cgroup.h        |   8 +-
 block/blk-iocost.c        |  22 ++++--
 block/blk-iolatency.c     |  10 ++-
 block/blk-throttle.c      |  13 +++-
 mm/page_io.c              |   7 +-
 9 files changed, 158 insertions(+), 90 deletions(-)

base-commit: b23df513de562739af61fa61ba80ef5e8059a636

Signature · 1 line
2.51.0