Re: Announce: Semaphore-Removal tree

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matthew Wilcox
Date: Monday, April 28, 2008 - 5:20 am

On Mon, Apr 28, 2008 at 03:10:40PM +1000, David Chinner wrote:

I'm glad you asked!

Arjan, Ingo and I have been batting around something called a kcounter.
I appear to have misplaced the patch right now, but the basic idea is
that it returns you a cookie when you down(), which you then have to
pass to the up()-equivalent.  This gives you at least some of the
assurances you get from mutexes.

Though ... looking at XFS, you have 5 counting semaphores currently:

1. i_flock

This one seems to be a mutex.  I'd need to immerse myself in XFS for a
couple of days to verify that though -- there's a lot of places that use
it, and it doesn't have obvious lock/unlock pairing.  Is it sometimes
unlocked from a different thread than the one which locked it?  If so,
kcounters might be the right thing to use here.

2. l_flushsema

This seems to be a completion.  ie you're using it to wait for the log
to be flushed.

3. q_flock

Ow.  ow.  My brain hurts.  What are these semantics?

4. b_iodonesema

This should be a completion.  It's used to wait for the io to be
complete.

5. b_sema

This looks like a mutex, but I think it's released in a different
context from the one which acquires it.

-----

Possibly XFS should be using constructs like wait_on_bit instead of
semaphores.  See the implementation of wait_on_buffer for an example.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Announce: Semaphore-Removal tree, Matthew Wilcox, (Fri Apr 25, 10:00 am)
Re: Announce: Semaphore-Removal tree, Daniel Walker, (Fri Apr 25, 1:24 pm)
Re: Announce: Semaphore-Removal tree, Daniel Walker, (Fri Apr 25, 1:38 pm)
Re: Announce: Semaphore-Removal tree, Christoph Hellwig, (Fri Apr 25, 2:12 pm)
Re: Announce: Semaphore-Removal tree, Daniel Walker, (Fri Apr 25, 2:22 pm)
Re: Announce: Semaphore-Removal tree, Christoph Hellwig, (Sat Apr 26, 2:30 am)
Re: Announce: Semaphore-Removal tree, Peter Zijlstra, (Sat Apr 26, 6:39 am)
Re: Announce: Semaphore-Removal tree, Christoph Hellwig, (Sat Apr 26, 6:44 am)
Re: Announce: Semaphore-Removal tree, Stephen Rothwell, (Sat Apr 26, 6:54 am)
Re: Announce: Semaphore-Removal tree, Peter Zijlstra, (Sat Apr 26, 7:04 am)
Re: Announce: Semaphore-Removal tree, Matthew Wilcox, (Sat Apr 26, 8:59 am)
Re: Announce: Semaphore-Removal tree, Stephen Rothwell, (Sat Apr 26, 9:43 am)
Re: Announce: Semaphore-Removal tree, David Chinner, (Sun Apr 27, 9:59 pm)
Re: Announce: Semaphore-Removal tree, David Chinner, (Sun Apr 27, 10:10 pm)
Re: Announce: Semaphore-Removal tree, Matthew Wilcox, (Mon Apr 28, 5:20 am)
Re: Announce: Semaphore-Removal tree, David Chinner, (Mon Apr 28, 5:09 pm)
Re: Announce: Semaphore-Removal tree, Matthew Wilcox, (Mon Apr 28, 7:35 pm)
Re: Announce: Semaphore-Removal tree, David Chinner, (Mon Apr 28, 8:56 pm)
Re: Announce: Semaphore-Removal tree, Matthew Wilcox, (Wed Apr 30, 3:06 am)
Re: Announce: Semaphore-Removal tree, Matthew Wilcox, (Wed Apr 30, 3:21 am)
Re: Announce: Semaphore-Removal tree, David Chinner, (Wed Apr 30, 4:01 am)