Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965079AbVLRETY (ORCPT ); Sat, 17 Dec 2005 23:19:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965077AbVLRETY (ORCPT ); Sat, 17 Dec 2005 23:19:24 -0500 Received: from ms-smtp-03.nyroc.rr.com ([24.24.2.57]:62105 "EHLO ms-smtp-03.nyroc.rr.com") by vger.kernel.org with ESMTP id S965076AbVLRETX (ORCPT ); Sat, 17 Dec 2005 23:19:23 -0500 Date: Sat, 17 Dec 2005 23:18:54 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Nicolas Pitre cc: Linus Torvalds , David Howells , 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: 946 Lines: 26 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, 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. > Well, the one thing that is preventing this is the fact that interrupts don't call up and down, since down can schedule. Now they might do a down_trylock, but then if it would succeed, it would most likely call the up. So the semaphore would be back to what it was before the interrupt took place. But you do have a case about preemption. -- Steve - 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/