Re: [PATCH] arm64: add unlikely hint to MTE async fault check in el0_svc_common

From: Li Qiang

Date: Sun Sep 28 2025 - 05:01:28 EST


> Does this result in a measurable performance difference?
> Will

Hi,

I did not observe a measurable performance difference in micro-benchmarks
(e.g. syscall latency tests), since asynchronous MTE faults are extremely
rare and the branch is almost never taken.

However, `el0_svc_common()` is a very hot path. Without the `unlikely()`
hint, the compiler may not optimize for the common case, and after an
I-cache eviction or branch predictor state reset the fault check can
be mispredicted. Marking it as `unlikely()` makes the fast path layout
clearer and reduces the chance of branch misprediction in cold-start
situations, consistent with how other rare-condition checks are annotated.

Thanks,
Li Qiang