mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: [patch 2/4] futex-pi: Enforce waiter bit when owner died is detected
Date: Tue, 25 Apr 2006 16:41:06 -0000	[thread overview]
Message-ID: <20060425162421.149115000@localhost.localdomain> (raw)
In-Reply-To: <20060425162414.896662000@localhost.localdomain>

[-- Attachment #1: futex-pi-enforce-waiter-bit.patch --]
[-- Type: text/plain, Size: 1387 bytes --]


Enforce the waiter bit to be set, when the previous owner has died. This
simplifies the glibc handling of the possible race from userspace tasks
which try to get hold of the lock and cleanup the mess which was leftover
by the unexpectedly died previous owner.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

 kernel/futex.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.17-rc1-mm3/kernel/futex.c
===================================================================
--- linux-2.6.17-rc1-mm3.orig/kernel/futex.c
+++ linux-2.6.17-rc1-mm3/kernel/futex.c
@@ -1161,11 +1161,16 @@ static int futex_lock_pi(u32 __user *uad
 		 * failed. When the OWNER_DIED bit is set, then we
 		 * know that this is a robust futex and we actually
 		 * take the lock. This is safe as we are protected by
-		 * the hash bucket lock.
+		 * the hash bucket lock. We also set the waiters bit
+		 * unconditionally here, to simplify glibc handling of
+		 * multiple tasks racing to acquire the lock and
+		 * cleanup the problems which were left by the dead
+		 * owner.
 		 */
 		if (curval & FUTEX_OWNER_DIED) {
 			uval = newval;
-			newval = current->pid | FUTEX_OWNER_DIED;
+			newval = current->pid |
+				FUTEX_OWNER_DIED | FUTEX_WAITERS;
 
 			inc_preempt_count();
 			curval = futex_atomic_cmpxchg_inatomic(uaddr,

--


  parent reply	other threads:[~2006-04-25 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25 16:41 [patch 0/4] futex-pi updates Thomas Gleixner
2006-04-25 16:41 ` [patch 1/4] rtmutex: Remove buggy BUG_ON in PI boosting code Thomas Gleixner
2006-04-25 16:41 ` Thomas Gleixner [this message]
2006-04-25 16:41 ` [patch 3/4] rtmutex debug: printk correct task information Thomas Gleixner
2006-04-25 16:41 ` [patch 4/4] futex-pi: Make use of restart_block when interrupted Thomas Gleixner

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=20060425162421.149115000@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®