* [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()
@ 2021-02-17 11:58 qiang.zhang
2021-02-18 3:04 ` Lai Jiangshan
0 siblings, 1 reply; 4+ messages in thread
From: qiang.zhang @ 2021-02-17 11:58 UTC (permalink / raw)
To: tj, jiangshanlai, htejun; +Cc: linux-kernel
From: Zqiang <qiang.zhang@windriver.com>
The RCU read critical area already by preempt_disable/enable()
(equivalent to rcu_read_lock_sched/unlock_sched()) mark, so remove
rcu_read_lock/unlock().
Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---
kernel/workqueue.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0d150da252e8..c599835ad6c3 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4540,7 +4540,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)
@@ -4553,7 +4552,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
ret = !list_empty(&pwq->delayed_works);
preempt_enable();
- rcu_read_unlock();
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()
2021-02-17 11:58 [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested() qiang.zhang
@ 2021-02-18 3:04 ` Lai Jiangshan
2021-02-18 15:17 ` Paul E. McKenney
0 siblings, 1 reply; 4+ messages in thread
From: Lai Jiangshan @ 2021-02-18 3:04 UTC (permalink / raw)
To: Zhang, Qiang; +Cc: Tejun Heo, Tejun Heo, LKML, Paul E. McKenney
+CC Paul
On Wed, Feb 17, 2021 at 7:58 PM <qiang.zhang@windriver.com> wrote:
>
> From: Zqiang <qiang.zhang@windriver.com>
>
> The RCU read critical area already by preempt_disable/enable()
> (equivalent to rcu_read_lock_sched/unlock_sched()) mark, so remove
> rcu_read_lock/unlock().
I think we can leave it which acks like document, especially
workqueue_congested() is not performance crucial. Either way
is Ok for me.
If it needs to be changed, please also do the same for
rcu_read_lock() in wq_watchdog_timer_fn().
And __queue_work() and try_to_grab_pending() also use local_irq_save()
and rcu_read_lock() at the same time, but I don't know will these
local_irq_save() be changed to raw_local_irq_save() in PREEMPT_RT.
>
> Signed-off-by: Zqiang <qiang.zhang@windriver.com>
> ---
> kernel/workqueue.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 0d150da252e8..c599835ad6c3 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -4540,7 +4540,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)
> @@ -4553,7 +4552,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
>
> ret = !list_empty(&pwq->delayed_works);
> preempt_enable();
> - rcu_read_unlock();
>
> return ret;
> }
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()
2021-02-18 3:04 ` Lai Jiangshan
@ 2021-02-18 15:17 ` Paul E. McKenney
2021-02-22 9:13 ` 回复: " Zhang, Qiang
0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2021-02-18 15:17 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: Zhang, Qiang, Tejun Heo, Tejun Heo, LKML
On Thu, Feb 18, 2021 at 11:04:00AM +0800, Lai Jiangshan wrote:
> +CC Paul
>
>
> On Wed, Feb 17, 2021 at 7:58 PM <qiang.zhang@windriver.com> wrote:
> >
> > From: Zqiang <qiang.zhang@windriver.com>
> >
> > The RCU read critical area already by preempt_disable/enable()
> > (equivalent to rcu_read_lock_sched/unlock_sched()) mark, so remove
> > rcu_read_lock/unlock().
>
> I think we can leave it which acks like document, especially
> workqueue_congested() is not performance crucial. Either way
> is Ok for me.
If the rcu_read_lock() is removed, should there be a comment saying that
it interacts with synchronize_rcu()? Just in case one of the real-time
guys figures out a way to get the job done without disabling preemption...
Thanx, Paul
> If it needs to be changed, please also do the same for
> rcu_read_lock() in wq_watchdog_timer_fn().
>
> And __queue_work() and try_to_grab_pending() also use local_irq_save()
> and rcu_read_lock() at the same time, but I don't know will these
> local_irq_save() be changed to raw_local_irq_save() in PREEMPT_RT.
>
>
> >
> > Signed-off-by: Zqiang <qiang.zhang@windriver.com>
> > ---
> > kernel/workqueue.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> > index 0d150da252e8..c599835ad6c3 100644
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -4540,7 +4540,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)
> > @@ -4553,7 +4552,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
> >
> > ret = !list_empty(&pwq->delayed_works);
> > preempt_enable();
> > - rcu_read_unlock();
> >
> > return ret;
> > }
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* 回复: [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()
2021-02-18 15:17 ` Paul E. McKenney
@ 2021-02-22 9:13 ` Zhang, Qiang
0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qiang @ 2021-02-22 9:13 UTC (permalink / raw)
To: Lai Jiangshan, paulmck; +Cc: Tejun Heo, Tejun Heo, LKML
________________________________________
发件人: Paul E. McKenney <paulmck@kernel.org>
发送时间: 2021年2月18日 23:17
收件人: Lai Jiangshan
抄送: Zhang, Qiang; Tejun Heo; Tejun Heo; LKML
主题: Re: [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested()
[Please note: This e-mail is from an EXTERNAL e-mail address]
On Thu, Feb 18, 2021 at 11:04:00AM +0800, Lai Jiangshan wrote:
> +CC Paul
>
>
> On Wed, Feb 17, 2021 at 7:58 PM <qiang.zhang@windriver.com> wrote:
> >
> > From: Zqiang <qiang.zhang@windriver.com>
> >
> > The RCU read critical area already by preempt_disable/enable()
> > (equivalent to rcu_read_lock_sched/unlock_sched()) mark, so remove
> > rcu_read_lock/unlock().
>
> I think we can leave it which acks like document, especially
> workqueue_congested() is not performance crucial. Either way
> is Ok for me.
>
>If the rcu_read_lock() is removed, should there be a comment saying >that
>it interacts with synchronize_rcu()? Just in case one of the real-time
>guys figures out a way to get the job done without disabling >preemption...
>
> Thanx, Paul
>
> If it needs to be changed, please also do the same for
> rcu_read_lock() in wq_watchdog_timer_fn().
>
>
> And __queue_work() and try_to_grab_pending() also use local_irq_save()
> and rcu_read_lock() at the same time, but I don't know will these
> local_irq_save() be changed to raw_local_irq_save() in PREEMPT_RT.
The local_irq_save function is not change in PREEMPT_RT system.
Thanks
Qiang
>
>
> >
> > Signed-off-by: Zqiang <qiang.zhang@windriver.com>
> > ---
> > kernel/workqueue.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> > index 0d150da252e8..c599835ad6c3 100644
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -4540,7 +4540,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)
> > @@ -4553,7 +4552,6 @@ bool workqueue_congested(int cpu, struct workqueue_struct *wq)
> >
> > ret = !list_empty(&pwq->delayed_works);
> > preempt_enable();
> > - rcu_read_unlock();
> >
> > return ret;
> > }
> > --
> > 2.25.1
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-22 9:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-17 11:58 [PATCH] workqueue: Remove rcu_read_lock/unlock() in workqueue_congested() qiang.zhang
2021-02-18 3:04 ` Lai Jiangshan
2021-02-18 15:17 ` Paul E. McKenney
2021-02-22 9:13 ` 回复: " Zhang, Qiang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.