Skip to contentSkip to conversation

workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested()

PATCH Applied Zqiang 2 participants 4 messages Sep 4, 2025 Workqueue

lore
Share & tools
lore

Zqiang

author
#0 lore raw

PATCH 1/1 workqueue: Remove redundant rcu_read_lock/unlock() in workqueue_congested()

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

---
 kernel/workqueue.c | 2 --
 1 file changed, 2 deletions(-)
kernel/workqueue.c +0 -2
index c6b79b3675c3..831754e90071 100644
@@ -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;
 }
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/1 workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn()

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().

---
 kernel/workqueue.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/workqueue.c +0 -4
index 831754e90071..63b2685c2cb4 100644
@@ -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();
 
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw

Re: [PATCH] workqueue: Remove rcu_read_lock/unlock() in wq_watchdog_timer_fn()

Quoted 5 lines · Zqiang

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().

Applied to wq/for-6.18.

Thanks.

Signature · 1 line
tejun
maintainer Applied
#3 lore raw
In reply to Zqiang
Quoted 5 lines · Zqiang

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

Applied to wq/for-6.18.

Thanks.

Signature · 1 line
tejun