public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Eric Dumazet <dada1@cosmosbay.com>, Ingo Molnar <mingo@elte.hu>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ulrich Drepper <drepper@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock
Date: Sat, 21 Jul 2007 15:57:12 +0400	[thread overview]
Message-ID: <20070721115712.GA871@tv-sign.ru> (raw)

It is a bit annoying that do_exit() takes ->pi_lock to set PF_EXITING.
All we need is to synchronize with lookup_pi_state() which saw this task
without PF_EXITING under ->pi_lock.

Change do_exit() to use spin_unlock_wait().

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- t/kernel/exit.c~PF_EXIT	2007-06-19 17:09:15.000000000 +0400
+++ t/kernel/exit.c	2007-07-21 15:34:13.000000000 +0400
@@ -908,13 +908,13 @@ fastcall NORET_TYPE void do_exit(long co
 		schedule();
 	}
 
+	tsk->flags |= PF_EXITING;
 	/*
 	 * tsk->flags are checked in the futex code to protect against
 	 * an exiting task cleaning up the robust pi futexes.
 	 */
-	spin_lock_irq(&tsk->pi_lock);
-	tsk->flags |= PF_EXITING;
-	spin_unlock_irq(&tsk->pi_lock);
+	smp_mb();
+	spin_unlock_wait(&tsk->pi_lock);
 
 	if (unlikely(in_atomic()))
 		printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",


             reply	other threads:[~2007-07-21 11:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-21 11:57 Oleg Nesterov [this message]
2007-07-21 12:31 ` [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock Ingo Molnar
2007-07-21 14:18   ` Oleg Nesterov
2007-07-21 15:02     ` [PATCH] fix theoretical ccids_{read,write}_lock() race Oleg Nesterov
2007-07-21 19:02       ` Andrew Morton
2007-07-21 19:11         ` Oleg Nesterov
2007-07-21 19:21           ` Andrew Morton
2007-07-21 20:06             ` Oleg Nesterov
2007-07-21 15:05     ` [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock Ingo Molnar
2007-07-21 16:39       ` Oleg Nesterov
2007-08-06  7:30         ` Ingo Molnar
2007-07-22  0:31       ` Paul Mackerras

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=20070721115712.GA871@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=dada1@cosmosbay.com \
    --cc=drepper@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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