coredump: turn mm->core_startup_done into the pointer to struct core_state
authorOleg Nesterov <oleg@tv-sign.ru>
Fri, 25 Jul 2008 08:47:41 +0000 (01:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 25 Jul 2008 17:53:39 +0000 (10:53 -0700)
mm->core_startup_done points to "struct completion startup_done" allocated
on the coredump_wait()'s stack.  Introduce the new structure, core_state,
which holds this "struct completion".  This way we can add more info
visible to the threads participating in coredump without enlarging
mm_struct.

No changes in affected .o files.

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>
fs/exec.c
include/linux/mm_types.h
kernel/exit.c

index e347e6ed1617bd1d50013042eb0dc2947060ebb6..71734568f0188f1df9cb7f21349980c4df45395e 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1597,13 +1597,13 @@ static int coredump_wait(int exit_code)
 {
        struct task_struct *tsk = current;
        struct mm_struct *mm = tsk->mm;
-       struct completion startup_done;
+       struct core_state core_state;
        struct completion *vfork_done;
        int core_waiters;
 
        init_completion(&mm->core_done);
-       init_completion(&startup_done);
-       mm->core_startup_done = &startup_done;
+       init_completion(&core_state.startup);
+       mm->core_state = &core_state;
 
        core_waiters = zap_threads(tsk, mm, exit_code);
        up_write(&mm->mmap_sem);
@@ -1622,7 +1622,7 @@ static int coredump_wait(int exit_code)
        }
 
        if (core_waiters)
-               wait_for_completion(&startup_done);
+               wait_for_completion(&core_state.startup);
 fail:
        BUG_ON(mm->core_waiters);
        return core_waiters;
index 02a27ae78539cfe536106f46a8f89b50ea63985e..97819efd233348370f4d16585299989cce77bacd 100644 (file)
@@ -159,6 +159,10 @@ struct vm_area_struct {
 #endif
 };
 
+struct core_state {
+       struct completion startup;
+};
+
 struct mm_struct {
        struct vm_area_struct * mmap;           /* list of VMAs */
        struct rb_root mm_rb;
@@ -220,7 +224,8 @@ struct mm_struct {
        unsigned long flags; /* Must use atomic bitops to access the bits */
 
        /* coredumping support */
-       struct completion *core_startup_done, core_done;
+       struct core_state *core_state;
+       struct completion core_done;
 
        /* aio bits */
        rwlock_t                ioctx_list_lock;        /* aio lock */
index 28a44a2612dcdd6df6ab1d5746438230cae6492e..f7fa21dbced4b17d86347582a410e97c2f5c105c 100644 (file)
@@ -680,7 +680,7 @@ static void exit_mm(struct task_struct * tsk)
                up_read(&mm->mmap_sem);
                down_write(&mm->mmap_sem);
                if (!--mm->core_waiters)
-                       complete(mm->core_startup_done);
+                       complete(&mm->core_state->startup);
                up_write(&mm->mmap_sem);
 
                wait_for_completion(&mm->core_done);