Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection
From: Peter Zijlstra
Date: Fri Feb 26 2016 - 04:18:55 EST
On Thu, Feb 25, 2016 at 10:08:48PM +0100, Rafael J. Wysocki wrote:
> On Thursday, February 25, 2016 10:28:37 AM Peter Zijlstra wrote:
> > Its vile though; one should not spray IPIs if one can avoid it. Such
> > things are much better done with RCU. Sure sync_sched() takes a little
> > longer, but this isn't a fast path by any measure.
>
> I see, thanks!
>
> BTW, when cpufreq_update_util() callbacks are removed, I use synchronize_rcu()
> to wait for the running ones, but would it be better to use synchronize_sched()
> in there instead?
So I think we only call the callback with rq->lock held, in which case
sync_sched() is good enough.
It would allow you to get rid of the rcu_read_{,un}lock() calls as well.
The down-side is that it all makes the code a little harder to get,
because you're relying on caller context to DTRT.