]> bbs.cooldavid.org Git - net-next-2.6.git/commit
tracing/sched: Make preempt_schedule() notrace
authorSteven Rostedt <srostedt@redhat.com>
Thu, 3 Jun 2010 01:52:29 +0000 (21:52 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 3 Jun 2010 23:09:41 +0000 (19:09 -0400)
commitd1f74e20b5b064a130cd0743a256c2d3cfe84010
treeb93ab590c24bb08f6db0dfc2a3ba60fa43af7f92
parent9dda696f0de87a2e5cfabb147e28c76b7d3c6846
tracing/sched: Make preempt_schedule() notrace

The function tracer code uses ftrace_preempt_disable() to disable
preemption instead of normal preempt_disable(). But there's a slight
race condition that may cause it to lose a preemption check.

This was made to keep the function tracer from recursing on itself
by disabling preemption then having the enable call the function tracer
again, causing infinite recursion.

The bug was assumed to happen if the call was just in schedule, but
this is incorrect. The bug is caused by preempt_schedule() which
is called by preempt_enable(). The calling of preempt_enable() when
NEED_RESCHED was set would call preempt_schedule() which would call
the function tracer again.

By making the preempt_schedule() and add_preempt_count() notrace
then this will prevent the inifinite recursion. This is because
the add_preempt_count() would stop the preempt_enable() in the
function tracer from calling preempt_schedule() again.

The sub_preempt_count() is also made notrace just to keep it
symmetric.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/sched.c