Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762855AbZAOI5n (ORCPT ); Thu, 15 Jan 2009 03:57:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757774AbZAOI52 (ORCPT ); Thu, 15 Jan 2009 03:57:28 -0500 Received: from cmpxchg.org ([85.214.51.133]:58656 "EHLO cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757461AbZAOI51 (ORCPT ); Thu, 15 Jan 2009 03:57:27 -0500 X-Greylist: delayed 950 seconds by postgrey-1.27 at vger.kernel.org; Thu, 15 Jan 2009 03:57:26 EST Date: Thu, 15 Jan 2009 09:56:25 +0100 From: Johannes Weiner To: Peter Zijlstra Cc: Linus Torvalds , Ingo Molnar , "Paul E. McKenney" , Gregory Haskins , Matthew Wilcox , Andi Kleen , Chris Mason , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich , Dmitry Adamushko Subject: Re: [PATCH] mutex: set owner only once on acquisition Message-ID: <20090115085625.GA15038@cmpxchg.org> References: <1231774622.4371.96.camel@laptop> <1231859742.442.128.camel@twins> <1231863710.7141.3.camel@twins> <1231864854.7141.8.camel@twins> <1231867314.7141.16.camel@twins> <20090115083951.GA13930@cmpxchg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090115083951.GA13930@cmpxchg.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1108 Lines: 30 On Thu, Jan 15, 2009 at 09:41:01AM +0100, Johannes Weiner wrote: > mutex_lock() sets the lock owner, no need to set it upfront in > __mutex_lock_common(). > > Inside __mutex_lock_common() we can cope with the case where the > successful acquirer got preempted by us before setting the owner > field: there is an explicit check in the spinning code and the > sleeping part doesn't rely on it. > > The debug code does owner checks only on unlock where the field is > garuanteed to be set. > > Signed-off-by: Johannes Weiner > --- > kernel/mutex.c | 2 -- > 1 file changed, 2 deletions(-) > > Just a small observation. Peter said it wouldn't matter much as the > write is to a hot cache line. But otoh, why keep it if it's not > necessary. :) Damn, I'm really async here, sorry Peter. Just noticed you already picked it up. Hannes -- 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/