From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937664AbXGUL5L (ORCPT ); Sat, 21 Jul 2007 07:57:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758492AbXGUL47 (ORCPT ); Sat, 21 Jul 2007 07:56:59 -0400 Received: from mail.screens.ru ([213.234.233.54]:42767 "EHLO mail.screens.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757466AbXGUL47 (ORCPT ); Sat, 21 Jul 2007 07:56:59 -0400 Date: Sat, 21 Jul 2007 15:57:12 +0400 From: Oleg Nesterov To: Andrew Morton Cc: Alexey Kuznetsov , Eric Dumazet , Ingo Molnar , Steven Rostedt , Thomas Gleixner , Ulrich Drepper , linux-kernel@vger.kernel.org Subject: [PATCH] pi-futex: set PF_EXITING without taking ->pi_lock Message-ID: <20070721115712.GA871@tv-sign.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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",