The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Zqiang <qiang.zhang@linux.dev>
To: tj@kernel.org, jiangshanlai@gmail.com
Cc: linux-kernel@vger.kernel.org, qiang.zhang@linux.dev
Subject: [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested()
Date: Thu,  4 Sep 2025 19:31:32 +0800	[thread overview]
Message-ID: <20250904113133.24487-1-qiang.zhang@linux.dev> (raw)

The preempt_disable/enable() has already formed RCU read crtical
section, this commit therefore remove rcu_read_lock/unlock() in
workqueue_congested().

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
 kernel/workqueue.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c6b79b3675c3..831754e90071 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6046,7 +6046,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
 	struct pool_workqueue *pwq;
 	bool ret;
 
-	rcu_read_lock();
 	preempt_disable();
 
 	if (cpu == WORK_CPU_UNBOUND)
@@ -6056,7 +6055,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
 	ret = !list_empty(&pwq->inactive_works);
 
 	preempt_enable();
-	rcu_read_unlock();
 
 	return ret;
 }
-- 
2.17.1


             reply	other threads:[~2025-09-04 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 11:31 Zqiang [this message]
2025-09-04 11:31 ` [PATCH] workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn() Zqiang
2025-09-04 16:18   ` Tejun Heo
2025-09-04 16:18 ` [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested() Tejun Heo

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=20250904113133.24487-1-qiang.zhang@linux.dev \
    --to=qiang.zhang@linux.dev \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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