]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm64: add unlikely hint to MTE async fault check in el0_svc_common
authorLi Qiang <liqiang01@kylinos.cn>
Fri, 19 Sep 2025 03:33:27 +0000 (11:33 +0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 11 Nov 2025 19:49:19 +0000 (19:49 +0000)
Add unlikely() hint to the _TIF_MTE_ASYNC_FAULT flag check in
el0_svc_common() since asynchronous MTE faults are expected to be
rare occurrences during normal system call execution.

This optimization helps the compiler to improve instruction caching
and branch prediction for the common case where no asynchronous
MTE faults are pending, while maintaining correct behavior for
the exceptional case where such faults need to be handled prior
to system call execution.

Signed-off-by: Li Qiang <liqiang01@kylinos.cn>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/syscall.c

index aba7ca6bca2d1a1640458d241575facd7852c4c4..c062badd1a566c7e8c18d9c02f6c853945031043 100644 (file)
@@ -96,7 +96,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr,
         * (Similarly for HVC and SMC elsewhere.)
         */
 
-       if (flags & _TIF_MTE_ASYNC_FAULT) {
+       if (unlikely(flags & _TIF_MTE_ASYNC_FAULT)) {
                /*
                 * Process the asynchronous tag check fault before the actual
                 * syscall. do_notify_resume() will send a signal to userspace