Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1356100

Re: [PATCH 1/5] workqueue: wq_pool_mutex protects the attrs-installation

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/5] workqueue: wq_pool_mutex protects the attrs-installation
Date 2016-03-11 19:00 +0100
Message-ID <rbzvY-1lH-13@gated-at.bofh.it> (permalink)
References <poSlQ-4TX-13@gated-at.bofh.it> <poSlR-4TX-35@gated-at.bofh.it> <rbgD0-4w0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello, Steven.

On Thu, Mar 10, 2016 at 04:44:11PM -0500, Steven Rostedt wrote:
> > diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> > index a3915ab..fa8b949 100644
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -127,6 +127,12 @@ enum {
> >   *
> >   * PR: wq_pool_mutex protected for writes.  Sched-RCU protected for reads.
> >   *
> > + * PW: wq_pool_mutex and wq->mutex protected for writes.  Any one of them
> > + *     protected for reads.
> > + *
> > + * PWR: wq_pool_mutex and wq->mutex protected for writes. Any one of them
> > + *      or sched-RCU for reads.
> 
> How exactly is sched-RCU protecting this here? The cause for the 4.1-rt issue
> is that we converted the local_irq_save() in queue_work_on() into a
> "local_lock_irqsave()" which when PREEMPT_RT is enabled will be a mutex that
> disables migration (can not migrate). This also prevents the current CPU from
> going offline.
> 
> Does this code really need to be protected from being preempted, or is
> disabling migration good enough?

That's used for workqueue->numa_pwq_tbl[] and it's derefed while
determining the pwq to use for the node.  The queueing path already
has local irq disabled and pwqs are sched rcu protected.  If the task
gets preempted inbetween, sched rcu grace period might trigger and
queueing path might try to deref an already free pwq, so yeah, I think
it does need preemption protection there.

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/5] workqueue: wq_pool_mutex protects the  attrs-installation Steven Rostedt <rostedt@goodmis.org> - 2016-03-10 22:50 +0100
  Re: [PATCH 1/5] workqueue: wq_pool_mutex protects the  attrs-installation Tejun Heo <tj@kernel.org> - 2016-03-11 19:00 +0100

csiph-web