[PATCH 02/31] utrace: add utrace_init_task/utrace_free_task calls

Oleg Nesterov oleg at redhat.com
Wed Aug 3 19:09:29 UTC 2011


Add the necessary copy_process()->utrace_init_task() and
free_task()->utrace_free_task() calls.

Originally this was the part of "utrace core" patch, but since
tracehooks are dying it doesn't make sense to reintroduce them.
Instead, just call the utrace_ helpers directly. This is fine
even without CONFIG_UTRACE, gcc is smart enough to optimize out
the code in free_task().

Signed-off-by: Oleg Nesterov <oleg at redhat.com>
---
 kernel/fork.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index e7ceaca..a9891da 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -66,6 +66,7 @@
 #include <linux/user-return-notifier.h>
 #include <linux/oom.h>
 #include <linux/khugepaged.h>
+#include <linux/utrace.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
@@ -167,6 +168,8 @@ void free_task(struct task_struct *tsk)
 	free_thread_info(tsk->stack);
 	rt_mutex_debug_task_free(tsk);
 	ftrace_graph_exit_task(tsk);
+	if (task_utrace_struct(tsk))
+		utrace_free_task(tsk);
 	free_task_struct(tsk);
 }
 EXPORT_SYMBOL(free_task);
@@ -1096,6 +1099,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 	if (!p)
 		goto fork_out;
 
+	utrace_init_task(p);
+
 	ftrace_graph_init_task(p);
 
 	rt_mutex_init_task(p);
-- 
1.5.5.1




More information about the kernel mailing list