From: David Howells Subject: Re: [RFC] Add support for semaphore-like structure with support for asynchronous I/O Date: Sat, 16 Apr 2005 12:06:10 +0100 Message-ID: <17024.1113649570@redhat.com> References: <1113604974.27810.75.camel@lade.trondhjem.org> <20050408223927.GA22217@kvack.org> <1112224663.18019.39.camel@lade.trondhjem.org> <1112309586.27458.19.camel@lade.trondhjem.org> <20050331161350.0dc7d376.akpm@osdl.org> <1112318537.11284.10.camel@lade.trondhjem.org> <20050401141225.GA3707@in.ibm.com> <20050404155245.GA4659@in.ibm.com> <20050404162216.GA18469@kvack.org> <1112637395.10602.95.camel@lade.trondhjem.org> <20050405154641.GA27279@kvack.org> <20050407114302.GA13363@infradead.org> <29082.1113581624@redhat.com> Cc: Benjamin LaHaise , Christoph Hellwig , Suparna Bhattacharya , Andrew Morton , linux-kernel@vger.kernel.org, Linux Filesystem Development , linux-aio@kvack.org Return-path: In-Reply-To: <1113604974.27810.75.camel@lade.trondhjem.org> To: Trond Myklebust Sender: owner-linux-aio@kvack.org List-Id: linux-fsdevel.vger.kernel.org Trond Myklebust wrote: > > AFAICS You grab the wait_queue_t lock once in down()/__mutex_lock() > order to try to take the lock (or queue the waiter if that fails), then > once more in order to pass the mutex on to the next waiter on > up()/mutex_unlock(). That is more or less the exact same thing I was > doing with iosems using bog-standard waitqueues, and which Ben has > adapted to his mutexes. What am I missing? In Ben's patch it looks like the down() grabs the spinlock twice. Once to queue yourself and one to dequeue yourself. The up() grabs the spinlock once to wake you up, but it wasn't obvious that it actually dequeues you. David -- To unsubscribe, send a message with 'unsubscribe linux-aio' in the body to majordomo@kvack.org. For more info on Linux AIO, see: http://www.kvack.org/aio/ Don't email: aart@kvack.org