public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Don't apply for write lock on tasklist_lock if parent doesn't ptrace other processes
@ 2010-07-15  6:51 Zhang, Yanmin
  2010-07-15 19:53 ` David Rientjes
  2010-07-21 21:49 ` Andrew Morton
  0 siblings, 2 replies; 15+ messages in thread
From: Zhang, Yanmin @ 2010-07-15  6:51 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, andi.kleen

We run some sub-cases (fork, exec, pipe, tcp, udp) of aim7 on 8-socket machine.
Perf shows write_lock_irq(&tasklist_lock) consumes more than 50% cpu time.

One hot caller is exit_ptrace. If the exiting process doesn't ptrace other
processes, kernel needn't apply for the write lock on tasklist_lock.

With below patch against kernel 2.6.35-rc5, we get more than 10% result improvement.

Signed-off-by: Zhang Yanmin <yanmin_zhang@linux.intel.com>

---

diff -Nraup linux-2.6.35-rc5/kernel/ptrace.c linux-2.6.35-rc5_ptrace/kernel/ptrace.c
--- linux-2.6.35-rc5/kernel/ptrace.c	2010-07-16 14:01:15.000000000 +0800
+++ linux-2.6.35-rc5_ptrace/kernel/ptrace.c	2010-07-16 14:03:20.000000000 +0800
@@ -331,6 +331,9 @@ void exit_ptrace(struct task_struct *tra
 	struct task_struct *p, *n;
 	LIST_HEAD(ptrace_dead);
 
+	if (list_empty(&tracer->ptraced))
+		return;
+
 	write_lock_irq(&tasklist_lock);
 	list_for_each_entry_safe(p, n, &tracer->ptraced, ptrace_entry) {
 		if (__ptrace_detach(tracer, p))



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

end of thread, other threads:[~2010-07-29 17:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15  6:51 [PATCH] Don't apply for write lock on tasklist_lock if parent doesn't ptrace other processes Zhang, Yanmin
2010-07-15 19:53 ` David Rientjes
2010-07-21 21:49 ` Andrew Morton
2010-07-21 22:25   ` Roland McGrath
2010-07-22  9:05     ` Oleg Nesterov
2010-07-22 19:24       ` Roland McGrath
2010-07-23 17:40         ` Oleg Nesterov
2010-07-23  8:45       ` Zhang, Yanmin
2010-07-23 17:34         ` Oleg Nesterov
2010-07-26  5:05           ` Zhang, Yanmin
2010-07-26  8:53             ` Oleg Nesterov
2010-07-26  9:40               ` Kleen, Andi
2010-07-27  1:15               ` Zhang, Yanmin
2010-07-29 15:12                 ` [PATCH] ptrace: optimize exit_ptrace() for the likely case Oleg Nesterov
2010-07-29 17:40                   ` Roland McGrath

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