Messages in this thread Patch in this message |  | | Date | Sun, 15 Sep 2002 11:12:36 +0200 (CEST) | From | Ingo Molnar <> | Subject | [patch] exit-thread-2.5.34-A0, BK-curr |
| |
the attached patch optimizes sys_exit_group() to only take the siglock if it's a true thread group. Boots & works fine.
Ingo
--- linux/kernel/exit.c.orig Sun Sep 15 10:59:15 2002 +++ linux/kernel/exit.c Sun Sep 15 11:02:21 2002 @@ -681,21 +681,25 @@ */ asmlinkage long sys_exit_group(int error_code) { - struct signal_struct *sig = current->sig; + unsigned int exit_code = (error_code & 0xff) << 8; - spin_lock_irq(&sig->siglock); - if (sig->group_exit) { - spin_unlock_irq(&sig->siglock); + if (!list_empty(¤t->thread_group)) { + struct signal_struct *sig = current->sig; + + spin_lock_irq(&sig->siglock); + if (sig->group_exit) { + spin_unlock_irq(&sig->siglock); - /* another thread was faster: */ - do_exit(sig->group_exit_code); + /* another thread was faster: */ + do_exit(sig->group_exit_code); + } + sig->group_exit = 1; + sig->group_exit_code = exit_code; + __broadcast_thread_group(current, SIGKILL); + spin_unlock_irq(&sig->siglock); } - sig->group_exit = 1; - sig->group_exit_code = (error_code & 0xff) << 8; - __broadcast_thread_group(current, SIGKILL); - spin_unlock_irq(&sig->siglock); - do_exit(sig->group_exit_code); + do_exit(exit_code); } static int eligible_child(pid_t pid, int options, task_t *p) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |