Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1521734 > unrolled thread

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

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-11-14 16:10 +0100
Last post2016-11-14 17:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/3] idle: add support for tasks that inject idle Peter Zijlstra <peterz@infradead.org> - 2016-11-14 16:10 +0100
    Re: [PATCH 1/3] idle: add support for tasks that inject idle Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-11-14 17:20 +0100
      Re: [PATCH 1/3] idle: add support for tasks that inject idle Peter Zijlstra <peterz@infradead.org> - 2016-11-14 17:30 +0100
        Re: [PATCH 1/3] idle: add support for tasks that inject idle Jacob Pan <jacob.jun.pan@linux.intel.com> - 2016-11-14 17:30 +0100

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

FromPeter Zijlstra <peterz@infradead.org>
Date2016-11-14 16:10 +0100
SubjectRe: [PATCH 1/3] idle: add support for tasks that inject idle
Message-ID<sDr3s-aQ-7@gated-at.bofh.it>
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?

[toc] | [next] | [standalone]


#1521806

FromJacob Pan <jacob.jun.pan@linux.intel.com>
Date2016-11-14 17:20 +0100
Message-ID<sDs9b-RG-9@gated-at.bofh.it>
In reply to#1521734
On Mon, 14 Nov 2016 16:01:19 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

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

right, the initial version has a timeout and
	init_timer_on_stack(timer);

I thought since this play_idle timer is likely to expire instead of
being canceled, so I switched to hrtimer by caller. We don't have an on
stack hrtimer, right? or Should we consider adding one?

Thanks,

Jacob

[toc] | [prev] | [next] | [standalone]


#1521821

FromPeter Zijlstra <peterz@infradead.org>
Date2016-11-14 17:30 +0100
Message-ID<sDsiR-Vh-19@gated-at.bofh.it>
In reply to#1521806
On Mon, Nov 14, 2016 at 08:20:28AM -0800, Jacob Pan wrote:
> On Mon, 14 Nov 2016 16:01:19 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > 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?
> 
> right, the initial version has a timeout and
> 	init_timer_on_stack(timer);
> 
> I thought since this play_idle timer is likely to expire instead of
> being canceled, so I switched to hrtimer by caller. We don't have an on
> stack hrtimer, right? or Should we consider adding one?

hrtimer_init_on_stack() exists.

[toc] | [prev] | [next] | [standalone]


#1521828

FromJacob Pan <jacob.jun.pan@linux.intel.com>
Date2016-11-14 17:30 +0100
Message-ID<sDsiS-Vh-37@gated-at.bofh.it>
In reply to#1521821
On Mon, 14 Nov 2016 17:22:11 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> hrtimer_init_on_stack() exists.

I missed it. let me move the timeout inside play_idle().

Thanks,

Jacob

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web