Re: [PATCH] tracing/function-return-tracer: don't trace kfreewhile it frees the return stack

From: Ingo Molnar
Date: Sun Nov 23 2008 - 11:44:46 EST



* Ingo Molnar <mingo@xxxxxxx> wrote:

> void ftrace_retfunc_exit_task(struct task_struct *t)
> {
> - kfree(t->ret_stack);
> + struct ftrace_ret_stack *ret_stack = t->ret_stack;
> +
> t->ret_stack = NULL;
> + /* NULL must become visible to IRQs before we free it: */
> + barrier();
> +
> + kfree(ret_stack);
> }

hm, this reminds me - this is the wrong place for the callback - the
call stack is freed too early.

instead of freeing it in do_exit() (like it's done right now), it
should be freed when the task struct and thread info is freed: in
kernel/fork.c:free_task() - okay?

The difference is minor but could allow more complete tracing: as
right now we'll skip the entries that get generated when we schedule
away from a dead task.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/