x86/process: Optimize TIF checks in __switch_to_xtra()
authorKyle Huey <me@kylehuey.com>
Tue, 14 Feb 2017 08:11:02 +0000 (00:11 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 11 Mar 2017 11:45:17 +0000 (12:45 +0100)
commitaf8b3cd3934ec60f4c2a420d19a9d416554f140b
tree1909a0e74eff01d3f4a15be59b097f63e38773ff
parent434fd6353b4c83938029ca6ea7dfa4fc82d602bd
x86/process: Optimize TIF checks in __switch_to_xtra()

Help the compiler to avoid reevaluating the thread flags for each checked
bit by reordering the bit checks and providing an explicit xor for
evaluation.

With default defconfigs for each arch,

x86_64: arch/x86/kernel/process.o
text       data     bss     dec     hex
3056       8577      16   11649    2d81 Before
3024    8577      16   11617    2d61 After

i386: arch/x86/kernel/process.o
text       data     bss     dec     hex
2957    8673       8   11638    2d76 Before
2925    8673       8   11606    2d56 After

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kyle Huey <khuey@kylehuey.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Link: http://lkml.kernel.org/r/20170214081104.9244-2-khuey@kylehuey.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/process.c