The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested()
@ 2025-09-04 11:31 Zqiang
  2025-09-04 11:31 ` [PATCH] workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn() Zqiang
  2025-09-04 16:18 ` [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested() Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Zqiang @ 2025-09-04 11:31 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel, qiang.zhang

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn()
  2025-09-04 11:31 [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested() Zqiang
@ 2025-09-04 11:31 ` 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
  1 sibling, 1 reply; 4+ messages in thread
From: Zqiang @ 2025-09-04 11:31 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel, qiang.zhang

The wq_watchdog_timer_fn() is executed in the softirq context, this
is already in the RCU read critical section, this commit therefore
remove rcu_read_lock/unlock() in wq_watchdog_timer_fn().

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

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 831754e90071..63b2685c2cb4 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -7544,8 +7544,6 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
 	if (!thresh)
 		return;
 
-	rcu_read_lock();
-
 	for_each_pool(pool, pi) {
 		unsigned long pool_ts, touched, ts;
 
@@ -7587,8 +7585,6 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
 
 	}
 
-	rcu_read_unlock();
-
 	if (lockup_detected)
 		show_all_workqueues();
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested()
  2025-09-04 11:31 [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested() Zqiang
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-09-04 16:18 UTC (permalink / raw)
  To: Zqiang; +Cc: jiangshanlai, linux-kernel

On Thu, Sep 04, 2025 at 07:31:32PM +0800, Zqiang wrote:
> 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>

Applied to wq/for-6.18.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn()
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-09-04 16:18 UTC (permalink / raw)
  To: Zqiang; +Cc: jiangshanlai, linux-kernel

On Thu, Sep 04, 2025 at 07:31:33PM +0800, Zqiang wrote:
> The wq_watchdog_timer_fn() is executed in the softirq context, this
> is already in the RCU read critical section, this commit therefore
> remove rcu_read_lock/unlock() in wq_watchdog_timer_fn().
> 
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>

Applied to wq/for-6.18.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-04 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 11:31 [PATCH] workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested() Zqiang
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox