Re: [patch 1/3] x86/process: Optimize TIF checks in switch_to_extra()

From: Andy Lutomirski
Date: Thu Dec 15 2016 - 12:25:31 EST


On Thu, Dec 15, 2016 at 8:44 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> - if (test_tsk_thread_flag(prev_p, TIF_BLOCKSTEP) ^
> - test_tsk_thread_flag(next_p, TIF_BLOCKSTEP)) {
> + tifn = task_thread_info(next_p)->flags;
> + tifp = task_thread_info(prev_p)->flags;

Minor nit, but I think that a sufficiently clever compiler could
interpret this to mean "no one else is modifying these flags, so I can
do clever crazy things". Wrapping these in READ_ONCE might be
helpful.