Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105941
b: refs/heads/master
c: b564daf
h: refs/heads/master
i:
  105939: c2ea9cc
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jul 25, 2008
1 parent 0da92e8 commit f63b060
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d5b327bf198d2720666de958dcc2ae219d86952
refs/heads/master: b564daf806d492dd4f7afe9b6c83b8d35d137669
2 changes: 2 additions & 0 deletions trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,8 @@ static int coredump_wait(int exit_code, struct core_state *core_state)

init_completion(&mm->core_done);
init_completion(&core_state->startup);
core_state->dumper.task = tsk;
core_state->dumper.next = NULL;
core_waiters = zap_threads(tsk, mm, core_state, exit_code);
up_write(&mm->mmap_sem);

Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/mm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,14 @@ struct vm_area_struct {
#endif
};

struct core_thread {
struct task_struct *task;
struct core_thread *next;
};

struct core_state {
atomic_t nr_threads;
struct core_thread dumper;
struct completion startup;
};

Expand Down
15 changes: 12 additions & 3 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ void mm_update_next_owner(struct mm_struct *mm)
static void exit_mm(struct task_struct * tsk)
{
struct mm_struct *mm = tsk->mm;
struct core_state *core_state;

mm_release(tsk, mm);
if (!mm)
Expand All @@ -676,11 +677,19 @@ static void exit_mm(struct task_struct * tsk)
* group with ->mm != NULL.
*/
down_read(&mm->mmap_sem);
if (mm->core_state) {
core_state = mm->core_state;
if (core_state) {
struct core_thread self;
up_read(&mm->mmap_sem);

if (atomic_dec_and_test(&mm->core_state->nr_threads))
complete(&mm->core_state->startup);
self.task = tsk;
self.next = xchg(&core_state->dumper.next, &self);
/*
* Implies mb(), the result of xchg() must be visible
* to core_state->dumper.
*/
if (atomic_dec_and_test(&core_state->nr_threads))
complete(&core_state->startup);

wait_for_completion(&mm->core_done);
down_read(&mm->mmap_sem);
Expand Down

0 comments on commit f63b060

Please sign in to comment.