Re: [PATCH 1/3] sched: Add new API wake_up_if_idle() to wake up the idle cpu

From: Peter Zijlstra
Date: Wed Sep 03 2014 - 05:54:39 EST


On Thu, Aug 21, 2014 at 02:21:51PM -0700, Andy Lutomirski wrote:
> On Aug 18, 2014 3:52 AM, "Chuansheng Liu" <chuansheng.liu@xxxxxxxxx> wrote:

> > +void wake_up_if_idle(int cpu)
> > +{
> > + struct rq *rq = cpu_rq(cpu);
> > + unsigned long flags;
> > +
> > + if (set_nr_if_polling(rq->idle)) {
> > + trace_sched_wake_idle_without_ipi(cpu);
> > + } else {
> > +
>
> FWIW, adding:
>
> if (rq->curr != rq->idle)
> return;
>
> Right here could improve performance on large, mostly non-idle
> systems. It would skip the spinlock in most cases.
>

!is_idle_task() :-)
--
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/