Re: [PATCH 01/10] blk-cgroup: use cgroup lock and rcu to protect iterating blkcg blkgs
From: Yu Kuai
Date: Thu Sep 25 2025 - 20:57:21 EST
Hi,
在 2025/09/26 1:07, Yu Kuai 写道:
Hi,
在 2025/9/25 23:57, Bart Van Assche 写道:
On 9/25/25 1:15 AM, Yu Kuai wrote:
It's safe to iterate blkgs with cgroup lock or rcu lock held, prevent
nested queue_lock under rcu lock, and prepare to convert protecting
blkcg with blkcg_mutex instead of queuelock.
Iterating blkgs without holding q->queue_lock is safe but accessing the
blkg members without holding that lock is not safe since q->queue_lock
is acquired by all code that modifies blkg members. Should perhaps a new
spinlock be introduced to serialize blkg modifications?
Actually, only blkcg_print_blkgs() is using rcu in this patch, and take
a look at the callers, I don't see anyone have to hold queue_lock. Can
you explain in detail which field from blkg is problematic in this
patch?
Thanks,
Kuai
No need for a new lock, I think blkcg->lock can do that.
Thanks,
Kuai
Thanks,.
Bart.