Re: [RFC][PATCH] ftrace: Use schedule_on_each_cpu() as a heavysynchronize_sched()

From: Steven Rostedt
Date: Wed Jun 05 2013 - 09:36:36 EST


On Wed, 2013-06-05 at 13:51 +0200, Peter Zijlstra wrote:

> > @@ -456,9 +471,13 @@ static int __unregister_ftrace_function(
> > /*
> > * Dynamic ops may be freed, we must make sure that all
> > * callers are done before leaving this function.
> > + *
> > + * Again, normal synchronize_sched() is not good enough.
> > + * We need to do a hard force of sched synchronization.
> > */
> > if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
> > - synchronize_sched();
> > + schedule_on_each_cpu(ftrace_sync);
> > +
> >
> > return 0;
> > }
> >
>
> So what happens if schedule_on_each_cpu() returns -ENOMEM? :-)

Hah! I was thinking the same thing when I wrote it, but as this was just
an RFC, I wanted to hear more about this current approach before adding
more.

I was going to also add something like this:

if (schedule_on_each_cpu(ftrace_sync) < 0) {
/*
* Crap, memory pressure caused this to fail.
* Do a synchronize_sched() and then a msleep().
* The race that fails synchronize_sched() is really small
* and a msleep() should clear it (but not guaranteed like
* a schedule_on_each_cpu() does).
*/
synchronize_sched();
msleep(5);
}

-- Steve


--
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/