Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754673AbZAISQs (ORCPT ); Fri, 9 Jan 2009 13:16:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752580AbZAISQh (ORCPT ); Fri, 9 Jan 2009 13:16:37 -0500 Received: from bombadil.infradead.org ([18.85.46.34]:54446 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751684AbZAISQg (ORCPT ); Fri, 9 Jan 2009 13:16:36 -0500 Subject: Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning From: Peter Zijlstra To: Steven Rostedt Cc: Linus Torvalds , Chris Mason , Ingo Molnar , paulmck@linux.vnet.ibm.com, Gregory Haskins , Matthew Wilcox , Andi Kleen , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich In-Reply-To: References: <1231441350.14304.48.camel@think.oraclecorp.com> <1231498062.11687.608.camel@twins> <1231513614.442.11.camel@twins> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 09 Jan 2009 19:16:04 +0100 Message-Id: <1231524964.442.103.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 942 Lines: 31 On Fri, 2009-01-09 at 11:44 -0500, Steven Rostedt wrote: > When we get to the schedule() it then needs to be a: > > preempt_enable_no_resched(); > schedule(); On that note: Index: linux-2.6/kernel/mutex.c =================================================================== --- linux-2.6.orig/kernel/mutex.c +++ linux-2.6/kernel/mutex.c @@ -220,7 +220,9 @@ __mutex_lock_common(struct mutex *lock, __set_task_state(task, state); /* didnt get the lock, go to sleep: */ + preempt_disable(); spin_unlock_mutex(&lock->wait_lock, flags); + preempt_enable_no_resched(); schedule(); spin_lock_mutex(&lock->wait_lock, flags); } actually improves mutex performance on PREEMPT=y -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/