From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758404Ab1DMLEM (ORCPT ); Wed, 13 Apr 2011 07:04:12 -0400 Received: from casper.infradead.org ([85.118.1.10]:35842 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757333Ab1DMLEL (ORCPT ); Wed, 13 Apr 2011 07:04:11 -0400 Subject: Re: [PATCH 04/21] sched: Change the ttwu success details From: Peter Zijlstra To: Chris Mason Cc: Frank Rowand , Ingo Molnar , Thomas Gleixner , Mike Galbraith , Oleg Nesterov , Paul Turner , Jens Axboe , Yong Zhang , linux-kernel@vger.kernel.org, Tejun Heo In-Reply-To: <1302691703.2035.10.camel@laptop> References: <20110405152338.692966333@chello.nl> <20110405152728.866866929@chello.nl> <1302686630.2388.125.camel@twins> <1302691703.2035.10.camel@laptop> Content-Type: text/plain; charset="UTF-8" Date: Wed, 13 Apr 2011 13:06:39 +0200 Message-ID: <1302692799.2035.17.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2011-04-13 at 12:48 +0200, Peter Zijlstra wrote: > On Wed, 2011-04-13 at 11:23 +0200, Peter Zijlstra wrote: > > and workqueue wakeups, and I doubt extra wakeups will cause lockups. > > Damn assumptions ;-) > > Index: linux-2.6/kernel/sched.c > =================================================================== > --- linux-2.6.orig/kernel/sched.c > +++ linux-2.6/kernel/sched.c > @@ -2447,7 +2447,7 @@ static inline void ttwu_post_activation( > } > #endif > /* if a worker is waking up, notify workqueue */ > - if ((p->flags & PF_WQ_WORKER) && success) > + if (p->flags & PF_WQ_WORKER) > wq_worker_waking_up(p, cpu_of(rq)); > } > > > Appears to be sufficient to cause the lockup, so somehow the whole > workqueue stuff relies on the fact that waking a TASK_(UN)INTERRUPTIBLE > task that hasn't been dequeued yet isn't a wakeup. > > Tejun any quick clues as to why and how to cure this? > > /me goes read that stuff OK, so wq_worker_waking_up() does an atomic_inc() that wants to be balanced against the atomic_dec() in wq_worker_sleeping(), which is only called when we dequeue things.