Re: [PATCH 0/3] 64-bit futexes: Intro

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ulrich Drepper <drepper@...>
Cc: <linux-kernel@...>, <akpm@...>, <mtk.manpages@...>
Date: Saturday, May 31, 2008 - 12:58 am

On Fri, 30 May 2008, Ulrich Drepper wrote:

Uli, you're NOT EVEN READING!

Go back and read it, dammit! How many times have I said that you can even 
have more than 32 bits of data? 

There's nothing wrong with using 64-bit atomics to update the words. All 
I've *ever* questioned is whether you need more than 32 bits for the 
FUTEX part.

For example, let's say that you need 4 bits of "state" information (ie 
"next woken-up one is a reader"). And yes, you need counts for readers and 
writers. Maybe we can make those counts be 30 bits each. 64 bits total 
space. But does the FUTEX_OP things actually need to access all 64 bits?

So imagine that you bave a 64-bit atomic op, and bits 0-1 are the reader 
state bits, with bits 2-31 being the reader count. Bits 32-33 are the 
writer state bits, and bits 34-63 are the writer count.

Now you can use 64-bit atomic ops to update them, but perhaps just use a 
32-bit FUTEX op to actually wait as a reader on the low 32 bits that are 
the reader state bits. See?

THIS is what I've been trying to tell you. It's quite possible that the 
algorithm you already have could work with just moving the bits around so 
that each FUTEX op can be done on just one of the words.

And notice my use of the word "possible". 

The kernel uses a 32-bit count word, but has various other state too that 
it maintains under a separate locking setup. Same basic idea: the 32-bit 
word is "special" (because it's the one that has to have the right format 
for the 'xadd' op that we use for the fast path), but it's not the _only_ 
data in the thing. The other data is also accessed, it's just accessed 
according to different principles.

			Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Fri May 30, 9:27 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri May 30, 10:13 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Fri May 30, 11:14 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri May 30, 11:44 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Sat May 31, 12:04 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:16 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:23 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ulrich Drepper, (Sat May 31, 12:38 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 6:25 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ingo Molnar, (Mon Jun 2, 2:54 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Mon Jun 2, 4:22 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Thu Jun 5, 9:27 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Thu Jun 5, 11:37 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Fri Jun 6, 7:53 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Fri Jun 6, 11:01 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Ingo Molnar, (Mon Jun 2, 7:03 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Mon Jun 2, 11:24 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 3:57 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:45 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 4:38 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:56 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Wed Jun 4, 11:08 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Thu Jun 5, 12:29 am)
Re: [PATCH 0/3] 64-bit futexes: Intro, Nick Piggin, (Wed Jun 4, 9:58 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 6:32 pm)
Re: [PATCH 0/3] 64-bit futexes: Intro, Linus Torvalds, (Sat May 31, 12:58 am)