Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1521724 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2016-11-14 16:00 +0100 |
| Last post | 2016-11-14 16:10 +0100 |
| Articles | 2 — 1 participant |
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.
Re: [PATCH 1/3] idle: add support for tasks that inject idle Peter Zijlstra <peterz@infradead.org> - 2016-11-14 16:00 +0100
Re: [PATCH 1/3] idle: add support for tasks that inject idle Peter Zijlstra <peterz@infradead.org> - 2016-11-14 16:10 +0100
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-11-14 16:00 +0100 |
| Subject | Re: [PATCH 1/3] idle: add support for tasks that inject idle |
| Message-ID | <sDqTM-8jU-11@gated-at.bofh.it> |
On Wed, Nov 09, 2016 at 11:05:10AM -0800, Jacob Pan wrote:
> static inline bool is_idle_task(const struct task_struct *p)
> {
> - return p->pid == 0;
> + return !!(p->flags & PF_IDLE);
> }
> +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;
Whoops, that will clear PF_IDLE from the idle thread. Maybe do something
like:
unsigned int idle_flag = (~current->flags & PF_IDLE)
current->flags |= PF_IDLE;
current->flags ^= idle_flag;
> +
> + preempt_fold_need_resched();
> + preempt_enable();
> +}
> +EXPORT_SYMBOL_GPL(play_idle);
> @@ -299,5 +313,7 @@ void cpu_startup_entry(enum cpuhp_state state)
> #endif
> arch_cpu_idle_prepare();
> cpuhp_online_idle(state);
> - cpu_idle_loop();
> + while (1)
> + do_idle();
> +
> }
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-11-14 16:10 +0100 |
| Message-ID | <sDr3t-aQ-37@gated-at.bofh.it> |
| In reply to | #1521724 |
On Mon, Nov 14, 2016 at 03:57:21PM +0100, Peter Zijlstra wrote:
> On Wed, Nov 09, 2016 at 11:05:10AM -0800, Jacob Pan wrote:
> > static inline bool is_idle_task(const struct task_struct *p)
> > {
> > - return p->pid == 0;
> > + return !!(p->flags & PF_IDLE);
> > }
>
> > +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;
>
> Whoops, that will clear PF_IDLE from the idle thread. Maybe do something
> like:
>
> unsigned int idle_flag = (~current->flags & PF_IDLE)
>
> current->flags |= PF_IDLE;
>
> current->flags ^= idle_flag;
>
> > +
> > + preempt_fold_need_resched();
> > + preempt_enable();
> > +}
> > +EXPORT_SYMBOL_GPL(play_idle);
n/m I cannot read, the actual idle loop below uses do_idle(), not
play_idle.
> > @@ -299,5 +313,7 @@ void cpu_startup_entry(enum cpuhp_state state)
> > #endif
> > arch_cpu_idle_prepare();
> > cpuhp_online_idle(state);
> > - cpu_idle_loop();
> > + while (1)
> > + do_idle();
> > +
> > }
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web