Messages in this thread | | | From | Andy Lutomirski <> | Date | Wed, 4 Jun 2014 07:46:54 -0700 | Subject | Re: [PATCH 4/6] sched,idle: Clear polling before descheduling the idle thread |
| |
On Wed, Jun 4, 2014 at 12:53 AM, Peter Zijlstra <peterz@infradead.org> wrote: > On Tue, Jun 03, 2014 at 05:29:50PM -0700, Andy Lutomirski wrote: >> @@ -229,6 +234,8 @@ static void cpu_idle_loop(void) >> */ >> preempt_set_need_resched(); >> tick_nohz_idle_exit(); >> + __current_clr_polling(); >> + smp_mb__after_clear_bit(); > > barriers always need a comment, and I'm not entirely sure why you put > this one here.
Will do.
I actually suspect that the barrier isn't needed in this patch, but it will be needed one patch later when there's a sched_ttwu_pending after the barrier. I'll move this to the next patch and add a comment.
The reason that the barrier is needed is that polling needs to be visibly cleared before checking for queued ttwu tasks, because otherwise another CPU could queue a ttwu task, do set_nr_if_polling, and get a true return value *after* sched_ttwu_pending because the CPU decided to defer the clear_bit.
--Andy
| |