]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
powerpc/64: Avoid restore_math call if possible in syscall exit
authorNicholas Piggin <npiggin@gmail.com>
Thu, 8 Jun 2017 15:35:05 +0000 (01:35 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 15 Jun 2017 06:34:39 +0000 (16:34 +1000)
commitbc4f65e4cf9d6cc43e0e9ba0b8648cf9201cd55f
treedcc4f6b0f90b5533b887651f93f38dd780f0d23a
parentacd7d8cef01537062e318143d700357d5a92bd6b
powerpc/64: Avoid restore_math call if possible in syscall exit

The syscall exit code that branches to restore_math is quite heavy on
Book3S, consisting of 2 mtmsr instructions. Threads that don't use both
FP and vector can get caught here if the kernel ever uses FP or vector.
Lazy-FP/vec context switching also trips this case.

So check for lazy FP and vector before switching RI for restore_math.
Move most of this case out of line.

For threads that do want to restore math registers, the MSR switches are
still suboptimal. Future direction may be to use a soft-RI bit to avoid
MSR switches in kernel (similar to soft-EE), but for now at least the
no-restore

POWER9 context switch rate increases by about 5% due to sched_yield(2)
return performance. I haven't constructed a test to measure the syscall
cost.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/process.c