diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-07-25 04:47:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:39 -0400 |
commit | 32ecb1f26dd50eeaac4e3f4dea4541c97848e459 (patch) | |
tree | 4c2f3b6af9ff6babf2f395432de8e870508f2ec3 | |
parent | 24d5288f06ed8b3a368eba967d587cdb012dfdf7 (diff) |
coredump: turn mm->core_startup_done into the pointer to struct core_state
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>
-rw-r--r-- | fs/exec.c | 8 | ||||
-rw-r--r-- | include/linux/mm_types.h | 7 | ||||
-rw-r--r-- | kernel/exit.c | 2 |
3 files changed, 11 insertions, 6 deletions
@@ -1597,13 +1597,13 @@ static int coredump_wait(int exit_code) | |||
1597 | { | 1597 | { |
1598 | struct task_struct *tsk = current; | 1598 | struct task_struct *tsk = current; |
1599 | struct mm_struct *mm = tsk->mm; | 1599 | struct mm_struct *mm = tsk->mm; |
1600 | struct completion startup_done; | 1600 | struct core_state core_state; |
1601 | struct completion *vfork_done; | 1601 | struct completion *vfork_done; |
1602 | int core_waiters; | 1602 | int core_waiters; |
1603 | 1603 | ||
1604 | init_completion(&mm->core_done); | 1604 | init_completion(&mm->core_done); |
1605 | init_completion(&startup_done); | 1605 | init_completion(&core_state.startup); |
1606 | mm->core_startup_done = &startup_done; | 1606 | mm->core_state = &core_state; |
1607 | 1607 | ||
1608 | core_waiters = zap_threads(tsk, mm, exit_code); | 1608 | core_waiters = zap_threads(tsk, mm, exit_code); |
1609 | up_write(&mm->mmap_sem); | 1609 | up_write(&mm->mmap_sem); |
@@ -1622,7 +1622,7 @@ static int coredump_wait(int exit_code) | |||
1622 | } | 1622 | } |
1623 | 1623 | ||
1624 | if (core_waiters) | 1624 | if (core_waiters) |
1625 | wait_for_completion(&startup_done); | 1625 | wait_for_completion(&core_state.startup); |
1626 | fail: | 1626 | fail: |
1627 | BUG_ON(mm->core_waiters); | 1627 | BUG_ON(mm->core_waiters); |
1628 | return core_waiters; | 1628 | return core_waiters; |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 02a27ae78539..97819efd2333 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -159,6 +159,10 @@ struct vm_area_struct { | |||
159 | #endif | 159 | #endif |
160 | }; | 160 | }; |
161 | 161 | ||
162 | struct core_state { | ||
163 | struct completion startup; | ||
164 | }; | ||
165 | |||
162 | struct mm_struct { | 166 | struct mm_struct { |
163 | struct vm_area_struct * mmap; /* list of VMAs */ | 167 | struct vm_area_struct * mmap; /* list of VMAs */ |
164 | struct rb_root mm_rb; | 168 | struct rb_root mm_rb; |
@@ -220,7 +224,8 @@ struct mm_struct { | |||
220 | unsigned long flags; /* Must use atomic bitops to access the bits */ | 224 | unsigned long flags; /* Must use atomic bitops to access the bits */ |
221 | 225 | ||
222 | /* coredumping support */ | 226 | /* coredumping support */ |
223 | struct completion *core_startup_done, core_done; | 227 | struct core_state *core_state; |
228 | struct completion core_done; | ||
224 | 229 | ||
225 | /* aio bits */ | 230 | /* aio bits */ |
226 | rwlock_t ioctx_list_lock; /* aio lock */ | 231 | rwlock_t ioctx_list_lock; /* aio lock */ |
diff --git a/kernel/exit.c b/kernel/exit.c index 28a44a2612dc..f7fa21dbced4 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -680,7 +680,7 @@ static void exit_mm(struct task_struct * tsk) | |||
680 | up_read(&mm->mmap_sem); | 680 | up_read(&mm->mmap_sem); |
681 | down_write(&mm->mmap_sem); | 681 | down_write(&mm->mmap_sem); |
682 | if (!--mm->core_waiters) | 682 | if (!--mm->core_waiters) |
683 | complete(mm->core_startup_done); | 683 | complete(&mm->core_state->startup); |
684 | up_write(&mm->mmap_sem); | 684 | up_write(&mm->mmap_sem); |
685 | 685 | ||
686 | wait_for_completion(&mm->core_done); | 686 | wait_for_completion(&mm->core_done); |