2009-07-16 10:56:46

by Anton Blanchard

[permalink] [raw]
Subject: [patch 3/5] perf_counter: Log vfork as a fork event

Right now we don't output vfork events. Even though we should always see an
exec after a vfork, we may get perfcounter samples between the vfork and exec.
These samples can lead to some confusion when parsing perfcounter data.

To keep things consistent we should always log a fork event. It will result
in a little more log data, but is less confusing to trace parsing tools.

Signed-off-by: Anton Blanchard <[email protected]>
---

It took me a while to realise this wasn't a bug in some trace parsing
code I wrote, or an issue with samples being dropped :)

Index: linux.trees.git/kernel/fork.c
===================================================================
--- linux.trees.git.orig/kernel/fork.c 2009-07-15 10:00:30.000000000 +1000
+++ linux.trees.git/kernel/fork.c 2009-07-15 10:01:28.000000000 +1000
@@ -1407,14 +1407,11 @@
if (clone_flags & CLONE_VFORK) {
p->vfork_done = &vfork;
init_completion(&vfork);
- } else if (!(clone_flags & CLONE_VM)) {
- /*
- * vfork will do an exec which will call
- * set_task_comm()
- */
- perf_counter_fork(p);
}

+ if (!(clone_flags & CLONE_THREAD))
+ perf_counter_fork(p);
+
audit_finish_fork(p);
tracehook_report_clone(regs, clone_flags, nr, p);


--


2009-07-18 09:51:01

by Anton Blanchard

[permalink] [raw]
Subject: [tip:perfcounters/urgent] perf_counter: Log vfork as a fork event

Commit-ID: ed900c054b541254f0ce5cedaf75206e29bd614e
Gitweb: http://git.kernel.org/tip/ed900c054b541254f0ce5cedaf75206e29bd614e
Author: Anton Blanchard <[email protected]>
AuthorDate: Thu, 16 Jul 2009 15:44:29 +0200
Committer: Ingo Molnar <[email protected]>
CommitDate: Sat, 18 Jul 2009 11:21:31 +0200

perf_counter: Log vfork as a fork event

Right now we don't output vfork events. Even though we should
always see an exec after a vfork, we may get perfcounter
samples between the vfork and exec. These samples can lead to
some confusion when parsing perfcounter data.

To keep things consistent we should always log a fork event. It
will result in a little more log data, but is less confusing to
trace parsing tools.

Signed-off-by: Anton Blanchard <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>


---
kernel/fork.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 467746b..4812d60 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1408,14 +1408,11 @@ long do_fork(unsigned long clone_flags,
if (clone_flags & CLONE_VFORK) {
p->vfork_done = &vfork;
init_completion(&vfork);
- } else if (!(clone_flags & CLONE_VM)) {
- /*
- * vfork will do an exec which will call
- * set_task_comm()
- */
- perf_counter_fork(p);
}

+ if (!(clone_flags & CLONE_THREAD))
+ perf_counter_fork(p);
+
audit_finish_fork(p);
tracehook_report_clone(regs, clone_flags, nr, p);