On 05/04/2015 05:26 AM, Paolo Bonzini wrote:
> 
> 
> On 02/05/2015 07:27, Ingo Molnar wrote:
>>
>>   - synchronize_rcu() avoids having to send an IPI by taking a 
>>     peak at rq->curr's pt_regs::flag, and if:
>>
>>      - the flag is 0 then it has observed a quiescent state.
>>
>>      - the flag is 1, then it would set TIF_NOHZ and wait for a 
>>        completion from a TIF_NOHZ callback.
> 
> Isn't this racy?
> 
>       synchronize_rcu CPU             nohz CPU
>       ---------------------------------------------------------
>                                       set flag = 0
>       read flag = 0
>                                       return to userspace
>       set TIF_NOHZ
> 
> and there's no guarantee that TIF_NOHZ is ever processed by the nohz CPU.

If the flag and TIF_NOHZ live in the same word, we can cmpxchg
and be guaranteed atomicity.

-- 
All rights reversed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to