coredump: move mm->core_waiters into struct core_state

Move mm->core_waiters into "struct core_state" allocated on stack.  This
shrinks mm_struct a little bit and allows further changes.

This patch mostly does s/core_waiters/core_state.  The only essential
change is that coredump_wait() must clear mm->core_state before return.

The coredump_wait()'s path is uglified and .text grows by 30 bytes, this
is fixed by the next patch.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Oleg Nesterov
2008-07-25 01:47:41 -07:00
committed by Linus Torvalds
parent 32ecb1f26d
commit 999d9fc167
5 changed files with 19 additions and 18 deletions

View File

@ -670,16 +670,16 @@ static void exit_mm(struct task_struct * tsk)
return;
/*
* Serialize with any possible pending coredump.
* We must hold mmap_sem around checking core_waiters
* We must hold mmap_sem around checking core_state
* and clearing tsk->mm. The core-inducing thread
* will increment core_waiters for each thread in the
* will increment ->nr_threads for each thread in the
* group with ->mm != NULL.
*/
down_read(&mm->mmap_sem);
if (mm->core_waiters) {
if (mm->core_state) {
up_read(&mm->mmap_sem);
down_write(&mm->mmap_sem);
if (!--mm->core_waiters)
if (!--mm->core_state->nr_threads)
complete(&mm->core_state->startup);
up_write(&mm->mmap_sem);