From: Benjamin LaHaise <bcrl@kvack.org>
To: Christoph Hellwig <hch@infradead.org>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
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, 8 Apr 2005 18:39:27 -0400 [thread overview]
Message-ID: <20050408223927.GA22217@kvack.org> (raw)
In-Reply-To: <20050407114302.GA13363@infradead.org>
On Thu, Apr 07, 2005 at 12:43:02PM +0100, Christoph Hellwig wrote:
> - switch all current semaphore users that don't need counting semaphores
> over to use a mutex_t type. For now it can map to struct semaphore.
> - rip out all existing complicated struct semaphore implementations and
> replace it with a portable C implementation. There's not a lot of users
> anyway. Add a mutex_t implementation that allows sensible assembly hooks
> for architectures instead of reimplementing all of it
> - add more features to mutex_t where nessecary
Oh dear, this is going to take a while. In any case, here is such a
first step in creating such a sequence of patches. Located at
http://www.kvack.org/~bcrl/patches/mutex-A0/ are the following patches:
00_mutex.diff - Introduces the basic mutex abstraction on top
of the existing semaphore implementation.
01_i_sem.diff - Converts all users of i_sem to use the mutex
abstraction.
10_new_mutex.diff - Replaces the semphore mutex with a new mutex
derrived from Trond's iosem patch. Note that
this fixes a serious bug in iosems: see the
change in mutex_lock_wake_function that ignores
the return value of default_wake_function, as
on SMP a process might still be running while
we actually made progress.
sem-test.c - A basic stress tester for the mutex / semaphore.
I'm still not convinced that introducing the mutex type is the best
approach, especially given the history of the up()/down() implementation.
On the aio side of things, I introduced the owner field in the mutex (as
opposed to the flag in Trond's iosem) for the next patch in the series to
enable something like the following api:
int aio_lock_mutex(struct mutex *lock, struct iocb *iocb);
...generic_file_read....
{
ret = mutex_lock_aio(&inode->i_sem, iocb);
if (ret)
return ret; /* aio_lock_mutex can return -EIOCBQUEUED */
...
mutex_unlock(&inode->i_sem);
}
mutex_lock_aio will attempt to take the lock if the iocb is not the owner,
otherwise it returns immediately (ie ->owner == iocb). This will allow for
code paths that support aio to follow a fairly similar coding style to the
synchronous io path.
More next week...
-ben
--
"Time is what keeps everything from happening all at once." -- John Wheeler
next prev parent reply other threads:[~2005-04-08 22:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-30 21:51 [RFC] Add support for semaphore-like structure with support for asynchronous I/O 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 [this message]
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
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=20050408223927.GA22217@kvack.org \
--to=bcrl@kvack.org \
--cc=akpm@osdl.org \
--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 \
--cc=trond.myklebust@fys.uio.no \
/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