From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
mtk.manpages@gmail.com
Subject: Re: [PATCH 0/3] 64-bit futexes: Intro
Date: Fri, 30 May 2008 21:58:24 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.1.10.0805302144170.3141@woody.linux-foundation.org> (raw)
In-Reply-To: <4840D63F.2090407@redhat.com>
On Fri, 30 May 2008, Ulrich Drepper wrote:
>
> Linus Torvalds wrote:
> > Is it possible? I dunno.
>
> Once again not without limitations which are too low. The main problem
> is that there is far more information needed on the reader side. There
> are two counters and a number of bits for state information. Which
> means the counters can be at most 14 bits in size.
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
next prev parent reply other threads:[~2008-05-31 4:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-31 1:27 Ulrich Drepper
2008-05-31 2:13 ` Linus Torvalds
2008-05-31 3:14 ` Ulrich Drepper
2008-05-31 3:44 ` Linus Torvalds
2008-05-31 4:04 ` Ulrich Drepper
2008-05-31 4:16 ` Linus Torvalds
2008-05-31 4:23 ` Linus Torvalds
2008-05-31 4:38 ` Ulrich Drepper
2008-05-31 4:58 ` Linus Torvalds [this message]
2008-05-31 22:25 ` Linus Torvalds
2008-05-31 22:32 ` Linus Torvalds
2008-06-02 18:54 ` Ingo Molnar
2008-06-02 20:22 ` Linus Torvalds
2008-06-02 23:03 ` Ingo Molnar
2008-06-03 3:24 ` Nick Piggin
2008-06-04 19:57 ` Linus Torvalds
2008-06-04 20:38 ` Linus Torvalds
2008-06-05 1:56 ` Nick Piggin
2008-06-05 1:58 ` Nick Piggin
2008-06-05 3:08 ` Linus Torvalds
2008-06-05 4:29 ` Nick Piggin
2008-06-05 1:45 ` Nick Piggin
2008-06-06 1:27 ` Nick Piggin
2008-06-06 3:37 ` Linus Torvalds
2008-06-06 11:53 ` Nick Piggin
2008-06-06 15:01 ` Linus Torvalds
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=alpine.LFD.1.10.0805302144170.3141@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=drepper@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.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®