OSDN Git Service

sched: Bring the PF_IO_WORKER and PF_WQ_WORKER bits closer together
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 19 Aug 2020 19:55:05 +0000 (21:55 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 26 Aug 2020 10:41:58 +0000 (12:41 +0200)
commit01ccf592362a984534371b3596d4c953da6a7bb2
tree27cda671f00ea1ffd9a2712b00685104ef815b5a
parent1724b95b92979a8ea8e55a4817d05b3bb7750958
sched: Bring the PF_IO_WORKER and PF_WQ_WORKER bits closer together

The bits PF_IO_WORKER and PF_WQ_WORKER are tested together in
sched_submit_work() which is considered to be a hot path.
If the two bits cross the 8 or 16 bit boundary then most architecture
require multiple load instructions in order to create the constant
value. Also, such a value can not be encoded within the compare opcode.

By moving the bit definition within the same block, the compiler can
create/use one immediate value.

For some reason gcc-10 on ARM64 requires both bits to be next to each
other in order to issue "tst reg, val; bne label". Otherwise the result
is "mov reg1, val; tst reg, reg1; bne label".

Move PF_VCPU out of the way so that PF_IO_WORKER can be next to
PF_WQ_WORKER.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200819195505.y3fxk72sotnrkczi@linutronix.de
include/linux/sched.h