Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030193AbVLRGbI (ORCPT ); Sun, 18 Dec 2005 01:31:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030192AbVLRGbI (ORCPT ); Sun, 18 Dec 2005 01:31:08 -0500 Received: from smtp.osdl.org ([65.172.181.4]:17874 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S1030191AbVLRGbG (ORCPT ); Sun, 18 Dec 2005 01:31:06 -0500 Date: Sat, 17 Dec 2005 22:30:41 -0800 (PST) From: Linus Torvalds To: Nicolas Pitre cc: David Howells , Steven Rostedt , linux-arch@vger.kernel.org, lkml , mingo@redhat.com, Andrew Morton Subject: Re: [PATCH 1/12]: MUTEX: Implement mutexes In-Reply-To: Message-ID: References: <200512162313.jBGND7g4019623@warthog.cambridge.redhat.com> <1134791914.13138.167.camel@localhost.localdomain> <14917.1134847311@warthog.cambridge.redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1037 Lines: 30 On Sat, 17 Dec 2005, Nicolas Pitre wrote: > > Now if you don't disable interrupts then nothing prevents an interrupt > handler, or another thread if kernel preemption is allowed Preemption, yes. Interrupts no. > to come > along right between (2) and (4) to call up() or down() which will > make the sem count inconsistent as soon as the interrupted down() or > up() is resumed. An interrupt can never change the value without changing it back, except for the old-fashioned use of "up()" as a completion (which I don't think we do any more - we used to do it for IO completion a looong time ago). So I think the interrupt disable could be removed for UP, at least for non-preemption. (Of course, maybe it's not worth it. It might not be a big performance issue). Linus - 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/