arm64: assembler: add cond_yield macro
authorArd Biesheuvel <ardb@kernel.org>
Wed, 3 Feb 2021 11:36:18 +0000 (12:36 +0100)
committerWill Deacon <will@kernel.org>
Wed, 3 Feb 2021 20:48:02 +0000 (20:48 +0000)
commitd13c613f136c9090f3863c49b2306d57ab59feba
tree1460b7bd70176eefcf74869c55d31e15908e4535
parent5c8fe583cce542aa0b84adc939ce85293de36e5e
arm64: assembler: add cond_yield macro

Add a macro cond_yield that branches to a specified label when called if
the TIF_NEED_RESCHED flag is set and decreasing the preempt count would
make the task preemptible again, resulting in a schedule to occur. This
can be used by kernel mode SIMD code that keeps a lot of state in SIMD
registers, which would make chunking the input in order to perform the
cond_resched() check from C code disproportionately costly.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210203113626.220151-2-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/assembler.h