From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753569Ab0LPTsG (ORCPT ); Thu, 16 Dec 2010 14:48:06 -0500 Received: from canuck.infradead.org ([134.117.69.58]:43787 "EHLO canuck.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192Ab0LPTsE convert rfc822-to-8bit (ORCPT ); Thu, 16 Dec 2010 14:48:04 -0500 Subject: Re: [RFC][PATCH 5/5] sched: Reduce ttwu rq->lock contention From: Peter Zijlstra To: Oleg Nesterov Cc: Chris Mason , Frank Rowand , Ingo Molnar , Thomas Gleixner , Mike Galbraith , Paul Turner , Jens Axboe , linux-kernel@vger.kernel.org In-Reply-To: <1292526220.2708.55.camel@laptop> References: <20101216145602.899838254@chello.nl> <20101216150920.968046926@chello.nl> <20101216184229.GA15889@redhat.com> <1292525893.2708.50.camel@laptop> <1292526220.2708.55.camel@laptop> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Thu, 16 Dec 2010 20:47:54 +0100 Message-ID: <1292528874.2708.85.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2010-12-16 at 20:03 +0100, Peter Zijlstra wrote: > On Thu, 2010-12-16 at 19:58 +0100, Peter Zijlstra wrote: > > > > + * Since we've already set TASK_WAKING this task's CPU cannot > > > > + * change from under us. > > > > > > I think it can. Yes, we've set TASK_WAKING. But, at least the task > > > itself can change its state back to TASK_RUNNING without calling > > > schedule. Say, __wait_event()-like code. > > > > Oh crud, you're right, that's going to make all this cmpxchg stuff lots > > more interesting :/ > > Hrmph, we can add a task_is_waking() test to the rq->lock in schedule(), > like we have for __task_rq_lock(): > > local_irq_save(flags); > again: > while (task_is_waking(current)) > cpu_relax(); > raw_spin_lock(rq->lock); > if (task_is_waking(current)) { > raw_spin_unlock(rq->lock); > goto again; > } > > > But that's not particularly pretty... OK, I'm just not thinking straight here, if we're not passing through schedule() the above clearly won't help any... Damn, that's a nasty case to solve... current->state = TASK_UNINTERRUPTIBLE; while (!true) schedule(); current->state = TASK_RUNNING; ... /me goes make a strong pot of tea