]> git.baikalelectronics.ru Git - kernel.git/commit
sched: Cache task_struct::flags in sched_submit_work()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 19 Aug 2020 20:00:25 +0000 (22:00 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 26 Aug 2020 10:41:58 +0000 (12:41 +0200)
commit792e3de38210d906657c74389e8f3eab29cd9d85
tree9fdcfe0c0b9d905d20932c1aba3971ac14bd2b4a
parent6b39725063cf92fb0789a1cc5ff4b19acfb97b22
sched: Cache task_struct::flags in sched_submit_work()

sched_submit_work() is considered to be a hot path. The preempt_disable()
instruction is a compiler barrier and forces the compiler to load
task_struct::flags for the second comparison.
By using a local variable, the compiler can load the value once and keep it in
a register for the second comparison.

Verified on x86-64 with gcc-10.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200819200025.lqvmyefqnbok5i4f@linutronix.de
kernel/sched/core.c