From: bh1scw@gmail.com
To: tj@kernel.org, axboe@kernel.dk
Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, songmuchun@bytedance.com,
Fanjun Kong <bh1scw@gmail.com>
Subject: [PATCH] blk-cgroup: Remove unnecessary rcu_read_lock/unlock()
Date: Tue, 17 May 2022 01:39:30 +0800 [thread overview]
Message-ID: <20220516173930.159535-1-bh1scw@gmail.com> (raw)
From: Fanjun Kong <bh1scw@gmail.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@gmail.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
next reply other threads:[~2022-05-16 17:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 17:39 bh1scw [this message]
2022-05-16 18:42 ` [PATCH] blk-cgroup: Remove unnecessary rcu_read_lock/unlock() Tejun Heo
2022-05-17 4:11 ` Muchun Song
2022-05-17 12:13 ` Jens Axboe
[not found] ` <CGME20220518192850eucas1p1458c00d4917c5ed39f2c37c9eb30cd46@eucas1p1.samsung.com>
2022-05-18 19:28 ` Marek Szyprowski
2022-05-18 22:29 ` Jens Axboe
2022-05-18 22:31 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220516173930.159535-1-bh1scw@gmail.com \
--to=bh1scw@gmail.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=songmuchun@bytedance.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).