From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: David Howells <dhowells@redhat.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>,
Christoph Hellwig <hch@infradead.org>,
Suparna Bhattacharya <suparna@in.ibm.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org,
Linux Filesystem Development <linux-fsdevel@vger.kernel.org>,
linux-aio@kvack.org
Subject: Re: [RFC] Add support for semaphore-like structure with support for asynchronous I/O
Date: Fri, 15 Apr 2005 15:42:54 -0700 [thread overview]
Message-ID: <1113604974.27810.75.camel@lade.trondhjem.org> (raw)
In-Reply-To: <29082.1113581624@redhat.com>
fr den 15.04.2005 Klokka 17:13 (+0100) skreiv David Howells:
> Can I suggest you don't use a wait_queue_t in your mutex? The way you've
> implemented your mutex you appear to have to take spinlocks and disable
> interrupts a lot more than is necessary.
> You might want to look at how I've implemented semaphores for the frv arch:
>
> include/asm-frv/semaphore.h
> arch/frv/kernel/semaphore.c
>
> On FRV disabling interrupts is quite expensive, so I've made my own simple
> semaphores that don't need to take spinlocks and disable interrupts in the
> down() path once the sleeping task has been queued[*]. These work in exactly
> the same way as rwsems.
> The point being that since up() needs to take the semaphore's spinlock
> anyway
> so that it can access the list, up() does all the necessary dequeuing
> of tasks
> before waking them up.
I'm looking at the code, and I'm completely failing to see your point.
Exactly how is that scheme incompatible with use of wait_queue_t?
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?
One of the motivations for doing that as far as the iosems were
concerned, BTW, was to avoid adding to this ecology of functionally
identical structures that we have for semaphores, rwsems, and wait
queues.
Cheers,
Trond
--
Trond Myklebust <trond.myklebust@fys.uio.no>
next prev parent reply other threads:[~2005-04-15 22:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-30 21:51 Trond Myklebust
2005-03-30 22:34 ` Andrew Morton
2005-03-30 23:17 ` Trond Myklebust
2005-03-30 23:44 ` Andrew Morton
2005-03-31 0:02 ` Trond Myklebust
2005-03-31 22:53 ` Trond Myklebust
2005-04-01 0:13 ` Andrew Morton
2005-04-01 1:22 ` Trond Myklebust
2005-04-01 14:12 ` Suparna Bhattacharya
[not found] ` <20050404155245.GA4659@in.ibm.com>
[not found] ` <20050404162216.GA18469@kvack.org>
2005-04-04 17:56 ` Trond Myklebust
2005-04-05 15:46 ` Benjamin LaHaise
2005-04-06 1:20 ` Trond Myklebust
2005-04-06 5:17 ` Bill Huey
2005-04-06 5:01 ` Suparna Bhattacharya
2005-04-07 11:43 ` Christoph Hellwig
2005-04-08 22:39 ` Benjamin LaHaise
2005-04-08 23:31 ` Trond Myklebust
2005-04-10 14:08 ` Suparna Bhattacharya
2005-04-15 16:13 ` David Howells
2005-04-15 22:42 ` Trond Myklebust [this message]
2005-04-15 23:42 ` Benjamin LaHaise
2005-04-16 11:12 ` David Howells
2005-04-16 11:06 ` David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1113604974.27810.75.camel@lade.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=akpm@osdl.org \
--cc=bcrl@kvack.org \
--cc=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=linux-aio@kvack.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suparna@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®