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

From: Linus Torvalds
Date: Sat May 31 2008 - 00:24:27 EST




On Fri, 30 May 2008, Linus Torvalds wrote:
>
> Also note how you can use 64-bit atomic ops to do that all in user space,
> without actually requiring 64-bit futex support - as long as the bits that
> matter for waking (like "was there more than one pending writer") fit in
> the one 32-bit word.

So here's an example of this:

- make all the readers/writers actually update a 64-bit word (by using
cmpxchg8b in user space to actually get the locks)

- but organize things so that a reader only needs to look at the high 32
bits to actually make it's wakeup-decision, and a sleeping writer only
needs to look at the low 32 bits. How? Make the low bits of the words
contain the "contention status".

Is it possible? I dunno. I personally suspect it is. I also suspect you
didn't even try.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/