lkml.org 
[lkml]   [2014]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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


\
 
 \ /
  Last update: 2014-06-04 17:41    [W:0.061 / U:1.616 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site