Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756223AbXFXP3l (ORCPT ); Sun, 24 Jun 2007 11:29:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752568AbXFXP3c (ORCPT ); Sun, 24 Jun 2007 11:29:32 -0400 Received: from nic.NetDirect.CA ([216.16.235.2]:40909 "EHLO rubicon.netdirect.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbXFXP3b (ORCPT ); Sun, 24 Jun 2007 11:29:31 -0400 X-Originating-Ip: 74.102.207.204 Date: Sun, 24 Jun 2007 11:25:46 -0400 (EDT) From: "Robert P. J. Day" X-X-Sender: rpjday@localhost.localdomain To: Satyam Sharma cc: Arnd Bergmann , Florin Iucha , Linux Kernel Mailing List Subject: Re: "upping" a semaphore from interrupt context? In-Reply-To: Message-ID: References: <20070622173839.GB8398@iucha.net> <200706221934.18436.arnd@arndb.de> <200706231402.03617.arnd@arndb.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Net-Direct-Inc-MailScanner-Information: Please contact the ISP for more information X-Net-Direct-Inc-MailScanner: Found to be clean X-Net-Direct-Inc-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-36.8, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -15.00, INIT_RECVD_OUR_AUTH -20.00) X-Net-Direct-Inc-MailScanner-From: rpjday@mindspring.com Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1604 Lines: 35 On Sat, 23 Jun 2007, Satyam Sharma wrote: > On 6/23/07, Robert P. J. Day wrote: > > hang on, how is that true? as i read it, mutexes are more than > > just binary semaphores -- they have additional restrictions that > > regular semaphores don't. > > Yes, they do have additional restrictions (mutex_trylock() illegal > from contexts that cannot sleep, mutexes may only be unlocked by > tasks that took them in the first place). But note that these are > _implementation_ sanity checks that were introduced to catch > nonsensical usage, which was possible (and not explicitly being > guarded against, because of the generic-ness that was needed to be > maintained for the counted case too) with the "semaphore"s. > > > so i'm not convinced that binary semaphores can simply be replaced > > by mutexes, unless that's not what you meant here. > > I do mean precisely that. I really cannot think of any sensible / > normal usage case of binary semaphores that cannot be replaced with > either mutexes (if that's the kind of locking you actually want) or > completion handlers (if that's the kind of synchronization you > actually want). ok, i can see what you're getting at now. i'm just going to have to convince myself that, once you have mutexes and completions, you have no further need for even general counting semaphores. rday - 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/