在 2023/08/11 16:23, Michal Koutný 写道:
On Fri, Aug 11, 2023 at 09:44:55AM +0800, Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:
Now that this problem doesn't exist, I think it's ok just to remove this
comment.
Why doesn't the problem exist now?
IIUC, it does but it's prevented thanks to outer synchronization via
rq_qos_mutex. Hence the comment clarifies why is the lockdep_assert
placed here.
Yes, it'm implemented in the upper layer that rq_qos_add() and
blkcg_activate_policy() should be atmoic, and currently there is no
comments for that.
Perhaps it's better to add some comments like following in rq_qos_add()
instead?
diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 167be74df4ee..8e8c597ea01b 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -302,6 +302,11 @@ int rq_qos_add(struct rq_qos *rqos, struct gendisk
*disk, enum rq_qos_id id,
{
struct request_queue *q = disk->queue;
+ /*
+ * If rq_qos is used with cgroup policy, and cgroup policy can be
+ * initialized through cgroupfs, 'rq_qos_mutex' should be held
+ * untill blkcg_activate_policy() is done after this function
return.
+ */
lockdep_assert_held(&q->rq_qos_mutex);
rqos->disk = disk;
Michal