mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/4] coredump: turn core_state->nr_threads into atomic_t
@ 2008-06-16 16:31 Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2008-06-16 16:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

 include/linux/mm_types.h |    2 +-
 kernel/exit.c            |    5 ++---
 fs/exec.c                |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

--- 26-rc2/include/linux/mm_types.h~4_NR_ATOMIC	2008-06-15 15:26:29.000000000 +0400
+++ 26-rc2/include/linux/mm_types.h	2008-06-16 18:00:08.000000000 +0400
@@ -160,7 +160,7 @@ struct vm_area_struct {
 };
 
 struct core_state {
-	int nr_threads;
+	atomic_t nr_threads;
 	struct completion startup;
 };
 
--- 26-rc2/kernel/exit.c~4_NR_ATOMIC	2008-06-15 15:28:21.000000000 +0400
+++ 26-rc2/kernel/exit.c	2008-06-16 19:58:59.000000000 +0400
@@ -667,10 +667,9 @@ static void exit_mm(struct task_struct *
 	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);
--- 26-rc2/fs/exec.c~4_NR_ATOMIC	2008-06-16 17:23:59.000000000 +0400
+++ 26-rc2/fs/exec.c	2008-06-16 19:59:26.000000000 +0400
@@ -1585,7 +1585,7 @@ static inline int zap_threads(struct tas
 	}
 	rcu_read_unlock();
 done:
-	core_state->nr_threads = nr;
+	atomic_set(&core_state->nr_threads, nr);
 	mm->core_state = core_state;
 	return nr;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 4/4] coredump: turn core_state->nr_threads into atomic_t
@ 2008-07-06 15:22 Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2008-07-06 15:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

 include/linux/mm_types.h |    2 +-
 kernel/exit.c            |    5 ++---
 fs/exec.c                |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

--- 26-rc2/include/linux/mm_types.h~4_NR_ATOMIC	2008-06-15 15:26:29.000000000 +0400
+++ 26-rc2/include/linux/mm_types.h	2008-06-16 18:00:08.000000000 +0400
@@ -160,7 +160,7 @@ struct vm_area_struct {
 };
 
 struct core_state {
-	int nr_threads;
+	atomic_t nr_threads;
 	struct completion startup;
 };
 
--- 26-rc2/kernel/exit.c~4_NR_ATOMIC	2008-06-15 15:28:21.000000000 +0400
+++ 26-rc2/kernel/exit.c	2008-07-06 18:10:12.000000000 +0400
@@ -667,10 +667,9 @@ static void exit_mm(struct task_struct *
 	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);
--- 26-rc2/fs/exec.c~4_NR_ATOMIC	2008-07-06 17:43:14.000000000 +0400
+++ 26-rc2/fs/exec.c	2008-07-06 18:12:33.000000000 +0400
@@ -1586,7 +1586,7 @@ static inline int zap_threads(struct tas
 	}
 	rcu_read_unlock();
 done:
-	core_state->nr_threads = nr;
+	atomic_set(&core_state->nr_threads, nr);
 	return nr;
 }
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 4/4] coredump: turn core_state->nr_threads into atomic_t
@ 2008-06-28 13:17 Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2008-06-28 13:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

 include/linux/mm_types.h |    2 +-
 kernel/exit.c            |    5 ++---
 fs/exec.c                |    2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

--- 26-rc2/include/linux/mm_types.h~4_NR_ATOMIC	2008-06-15 15:26:29.000000000 +0400
+++ 26-rc2/include/linux/mm_types.h	2008-06-16 18:00:08.000000000 +0400
@@ -160,7 +160,7 @@ struct vm_area_struct {
 };
 
 struct core_state {
-	int nr_threads;
+	atomic_t nr_threads;
 	struct completion startup;
 };
 
--- 26-rc2/kernel/exit.c~4_NR_ATOMIC	2008-06-15 15:28:21.000000000 +0400
+++ 26-rc2/kernel/exit.c	2008-06-16 19:58:59.000000000 +0400
@@ -667,10 +667,9 @@ static void exit_mm(struct task_struct *
 	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);
--- 26-rc2/fs/exec.c~4_NR_ATOMIC	2008-06-16 17:23:59.000000000 +0400
+++ 26-rc2/fs/exec.c	2008-06-16 19:59:26.000000000 +0400
@@ -1585,7 +1585,7 @@ static inline int zap_threads(struct tas
 	}
 	rcu_read_unlock();
 done:
-	core_state->nr_threads = nr;
+	atomic_set(&core_state->nr_threads, nr);
 	mm->core_state = core_state;
 	return nr;
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-06 15:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-16 16:31 [PATCH 4/4] coredump: turn core_state->nr_threads into atomic_t Oleg Nesterov
2008-06-28 13:17 Oleg Nesterov
2008-07-06 15:22 Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®