From: Nikita Danilov Subject: Re: [RFC] Add support for semaphore-like structure with support for asynchronous I/O Date: Thu, 31 Mar 2005 21:09:11 +0400 Message-ID: <16972.11959.741426.960922@gargle.gargle.HOWL> References: <1112219491.10771.18.camel@lade.trondhjem.org> <16971.44683.69638.768508@gargle.gargle.HOWL> <1112272290.10975.71.camel@lade.trondhjem.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Linux Filesystem Development Return-path: Received: from [80.71.243.242] ([80.71.243.242]:8580 "EHLO tau.rusteko.ru") by vger.kernel.org with ESMTP id S261562AbVCaRJP (ORCPT ); Thu, 31 Mar 2005 12:09:15 -0500 To: Trond Myklebust In-Reply-To: <1112272290.10975.71.camel@lade.trondhjem.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Trond Myklebust writes: > to den 31.03.2005 Klokka 12:02 (+0400) skreiv Nikita Danilov: > > > As I understand it, in the blocking path IOSEM_LOCK_EXCLUSIVE is set by > > iosem_lock_wake_function() called by the waker thread. But this is > > asking for convoy formation: iosem_unlock() transfers ownership of the > > lock to the thread that is currently sleeping. This means that all > > threads _running_ on another processors and bumping into that lock will > > go to sleep too (i.e., lock is owned but unused), thus forming a > > "convoy" that has a tendency to grow over time when there is at least > > smallest contention. This is known problem with all "early ownership > > transfer" locks designs (except maybe in your case contention is not > > supposed to happen). > > You are assuming that all the waiters on the queue are tasks that must > sleep if they cannot take the lock. That is not the case here. Whereas > some users will indeed fall in this category, I expect that most will > rather want to use the non-blocking mode in which the caller is free to > go off and do other useful work. Ah, I see... But this doesn't look like semaphore _at_ _all_. Semaphores have no call-backs, and in iosem case it's callback (in the form of struct work_struct) that is central to the interface. I belive naming should reflect this, it's utterly confusing as it is. Maybe struct work_queue_token and schedule_work_{with,end}_token()? [...] > > Cheers, > Trond Nikita.