[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220516173930.159535-1-bh1scw@gmail.com>
Date: Tue, 17 May 2022 01:39:30 +0800
From: bh1scw@...il.com
To: tj@...nel.org, axboe@...nel.dk
Cc: cgroups@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, songmuchun@...edance.com,
Fanjun Kong <bh1scw@...il.com>
Subject: [PATCH] blk-cgroup: Remove unnecessary rcu_read_lock/unlock()
From: Fanjun Kong <bh1scw@...il.com>
spin_lock_irq/spin_unlock_irq contains preempt_disable/enable().
Which can serve as RCU read-side critical region, so remove
rcu_read_lock/unlock().
Signed-off-by: Fanjun Kong <bh1scw@...il.com>
---
block/blk-cgroup.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index a91f8ae18b49..7bdc16a36560 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1283,14 +1283,13 @@ int blkcg_init_queue(struct request_queue *q)
preloaded = !radix_tree_preload(GFP_KERNEL);
/* Make sure the root blkg exists. */
- rcu_read_lock();
+ /* spin_lock_irq can serve as RCU read-side critical section. */
spin_lock_irq(&q->queue_lock);
blkg = blkg_create(&blkcg_root, q, new_blkg);
if (IS_ERR(blkg))
goto err_unlock;
q->root_blkg = blkg;
spin_unlock_irq(&q->queue_lock);
- rcu_read_unlock();
if (preloaded)
radix_tree_preload_end();
@@ -1316,7 +1315,6 @@ int blkcg_init_queue(struct request_queue *q)
return ret;
err_unlock:
spin_unlock_irq(&q->queue_lock);
- rcu_read_unlock();
if (preloaded)
radix_tree_preload_end();
return PTR_ERR(blkg);
--
2.36.0
Powered by blists - more mailing lists