Re: [PATCH 1/3] idle: add support for tasks that inject idle

From: Peter Zijlstra
Date: Mon Nov 14 2016 - 10:01:28 EST


On Wed, Nov 09, 2016 at 11:05:10AM -0800, Jacob Pan wrote:
> +void play_idle()
> +{
> + /*
> + * Only FIFO tasks can disable the tick since they don't need the forced
> + * preemption.
> + */
> + WARN_ON_ONCE(current->policy != SCHED_FIFO);
> + WARN_ON_ONCE(current->nr_cpus_allowed != 1);
> + WARN_ON_ONCE(!(current->flags & PF_KTHREAD));
> + WARN_ON_ONCE(!(current->flags & PF_NO_SETAFFINITY));
> + rcu_sleep_check();
> +
> + preempt_disable();
> + current->flags |= PF_IDLE;
> + do_idle();
> + current->flags &= ~PF_IDLE;
> +
> + preempt_fold_need_resched();
> + preempt_enable();
> +}
> +EXPORT_SYMBOL_GPL(play_idle);

Hurm.. didn't this initially also include the setup of the timer and
take an timeout argument?