Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5f1cc8c authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds
Browse files

coredump: turn core_state->nr_threads into atomic_t



Turn core_state->nr_threads into atomic_t and kill now unneeded
down_write(&mm->mmap_sem) in exit_mm().

Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8cd9c249
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1591,7 +1591,7 @@ static inline int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
	}
	rcu_read_unlock();
done:
	core_state->nr_threads = nr;
	atomic_set(&core_state->nr_threads, nr);
	return nr;
}

+1 −1
Original line number Diff line number Diff line
@@ -160,7 +160,7 @@ struct vm_area_struct {
};

struct core_state {
	int nr_threads;
	atomic_t nr_threads;
	struct completion startup;
};

+2 −3
Original line number Diff line number Diff line
@@ -678,10 +678,9 @@ static void exit_mm(struct task_struct * tsk)
	down_read(&mm->mmap_sem);
	if (mm->core_state) {
		up_read(&mm->mmap_sem);
		down_write(&mm->mmap_sem);
		if (!--mm->core_state->nr_threads)

		if (atomic_dec_and_test(&mm->core_state->nr_threads))
			complete(&mm->core_state->startup);
		up_write(&mm->mmap_sem);

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