powerpc: During context switch, check before setting mm_cpumask
authorAnton Blanchard <anton@samba.org>
Mon, 3 Oct 2016 06:40:29 +0000 (17:40 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Oct 2016 05:12:16 +0000 (16:12 +1100)
commitbb85fb5803270c52863b983596c2a038facaf4b3
tree2995f9570fe4d5a9dbbc50a4f53827ea8252ce8b
parent91ac730b8b1d7c5e71e7ed2d785a61c27433e13d
powerpc: During context switch, check before setting mm_cpumask

During context switch, switch_mm() sets our current CPU in mm_cpumask.
We can avoid this atomic sequence in most cases by checking before
setting the bit.

Testing on a POWER8 using our context switch microbenchmark:

tools/testing/selftests/powerpc/benchmarks/context_switch \
--process --no-fp --no-altivec --no-vector

Performance improves 2%.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/mmu_context.h