perf_counter: Log vfork as a fork event
authorAnton Blanchard <anton@samba.org>
Thu, 16 Jul 2009 13:44:29 +0000 (15:44 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 18 Jul 2009 09:21:31 +0000 (11:21 +0200)
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 <anton@samba.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090716104817.589309391@samba.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/fork.c

index 467746b3f0aa2eec5970c42f56a71d8ae1583b7f..4812d60b29f83928188e7dedd4387145b02ca033 100644 (file)
@@ -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);