Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750919AbcCKRuU (ORCPT ); Fri, 11 Mar 2016 12:50:20 -0500 Received: from mail-yw0-f194.google.com ([209.85.161.194]:36459 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbcCKRuQ (ORCPT ); Fri, 11 Mar 2016 12:50:16 -0500 Date: Fri, 11 Mar 2016 12:50:13 -0500 From: Tejun Heo To: Steven Rostedt Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, Thomas Gleixner , Sebastian Andrzej Siewior Subject: Re: [PATCH 1/5] workqueue: wq_pool_mutex protects the attrs-installation Message-ID: <20160311175013.GJ24046@htj.duckdns.org> References: <1431336953-3260-1-git-send-email-laijs@cn.fujitsu.com> <1431336953-3260-2-git-send-email-laijs@cn.fujitsu.com> <20160310214411.GA1526@home.goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160310214411.GA1526@home.goodmis.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1437 Lines: 37 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