Commit c1cecf8
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.de1 parent 01ccf59 commit c1cecf8
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4551 | 4551 | | |
4552 | 4552 | | |
4553 | 4553 | | |
| 4554 | + | |
| 4555 | + | |
4554 | 4556 | | |
4555 | 4557 | | |
4556 | 4558 | | |
| 4559 | + | |
4557 | 4560 | | |
4558 | 4561 | | |
4559 | 4562 | | |
| |||
4562 | 4565 | | |
4563 | 4566 | | |
4564 | 4567 | | |
4565 | | - | |
| 4568 | + | |
4566 | 4569 | | |
4567 | | - | |
| 4570 | + | |
4568 | 4571 | | |
4569 | 4572 | | |
4570 | 4573 | | |
| |||
0 commit comments