linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Ulrich Drepper <drepper@redhat.com>,
	Andrew Morton <akpm@osdl.org>,
	Stephen Hemminger <shemminger@osdl.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Re: today's futex changes
Date: Sat, 6 Sep 2003 18:46:15 +0100	[thread overview]
Message-ID: <20030906174615.GA10987@mail.jlokier.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.44.0309061723160.1470-100000@localhost.localdomain>

Hugh Dickins wrote:
> The new bug is that "offset" has been declared as an alternative in
> the union, instead of as an element in the structures comprising it,
> effectively eliminating it from the key: keys match which should not.

Auch!

(Off to the post office for a pack of brown paper bags)
(And a pillow)

> The old bug is that if futex_requeue were called with identical
> key1 and key2 (sensible? tended to happen given the first bug),
> it was liable to loop for a long time holding futex_lock: guard
> against that, still respecting the semantics of futex_requeue.

That explains the hang I just saw in one run of Ulrich's test...
And it explain's why it's not repeatable.

With key1 == key2, you get to move nr_requeue waiters to the end of
the waiting list.  I can't think of a good use for it, but it does do
something visible.

> +				/* Make sure to stop if key1 == key2 */
> +				if (head1 == head2 && head1 != next)
> +					head1 = i;

Subtle, when nr_requeue > 1.  That's a disturbingly nice trick :)

> While here, please let's also fix the get_futex_key VM_NONLINEAR
> case, which was returning the 1 from get_user_pages, taken as an
> error by its callers.

Yes.  I just spotted it too.

> And save a few bytes and improve debuggability
> by uninlining the top-level futex_wake, futex_requeue, futex_wait.

Fair point about about debuggability, but does it really save bytes to
uninline these called-once functions?

-- Jamie

  parent reply	other threads:[~2003-09-06 17:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-05 20:24 today's futex changes Ulrich Drepper
2003-09-05 22:24 ` Stephen Hemminger
2003-09-06 16:28 ` [PATCH] " Hugh Dickins
2003-09-06 17:32   ` Ulrich Drepper
2003-09-06 17:44     ` Jamie Lokier
2003-09-06 17:46   ` Jamie Lokier [this message]
2003-09-06 18:21     ` Hugh Dickins
2003-09-08  6:45   ` Rusty Russell
2003-09-08 17:33     ` Hugh Dickins
2003-09-08 17:51       ` Hugh Dickins
2003-09-09  1:37       ` Rusty Russell
2003-09-08 17:51     ` Jamie Lokier
2003-09-08 18:26       ` Jamie Lokier
2003-09-09  3:58       ` Rusty Russell
2003-09-10 11:39         ` Jamie Lokier
2003-09-10 22:00           ` Rusty Russell
2003-09-11 16:29             ` Jamie Lokier
2003-09-08 19:02     ` Andrew Morton
2003-09-08 20:07       ` Jamie Lokier
2003-09-08 19:59         ` Andrew Morton
2003-09-08 20:11         ` Linus Torvalds
2003-09-09  4:12       ` Rusty Russell
2003-09-08 17:04   ` Stephen Hemminger

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=20030906174615.GA10987@mail.jlokier.co.uk \
    --to=jamie@shareable.org \
    --cc=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=shemminger@osdl.org \
    --cc=torvalds@osdl.org \
    /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;
as well as URLs for NNTP newsgroup(s).