Re: [PATCH 2/3] x86/asm: Move 'status' from thread_struct to thread_info
From: Linus Torvalds
Date: Sun Jan 28 2018 - 14:19:48 EST
On Sun, Jan 28, 2018 at 10:38 AM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>
> Linus suggested further changing:
>
> ti->status &= ~(TS_COMPAT|TS_I386_REGS_POKED);
>
> to:
>
> if (unlikely(ti->status & (TS_COMPAT|TS_I386_REGS_POKED)))
> ti->status &= ~(TS_COMPAT|TS_I386_REGS_POKED);
>
> on the theory that frequently dirtying the cacheline even in pure
> 64-bit code that never needs to modify status hurts performance.
> That could be a reasonable followup patch, but I suspect it matters
> less on top of this patch.
Ack, that should be done separately from the movement anyway.
And yes, it's possible that once it's in the same cacheline with the
thread flags, you can't even see the issue anyway. Although I *think*
all those early fields are normally mostly read-only, so that "read
before clear" may end up being a good idea regardless.
Linus