lkml.org 
[lkml]   [2013]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC][PATCH] ftrace: Use schedule_on_each_cpu() as a heavy synchronize_sched()
From
Date
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




\
 
 \ /
  Last update: 2013-06-05 16:21    [W:0.109 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site