]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function
authorBibo Mao <maobibo@loongson.cn>
Thu, 9 Apr 2026 10:56:36 +0000 (18:56 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Thu, 9 Apr 2026 10:56:36 +0000 (18:56 +0800)
commitc43dce6f13fb12144571c168c7a593e5e546f3b5
treeaf24b8f8d1576f5b77116b75181bcdc4df68c264
parentaac656857e9f008a014ac9d58aab66e8fc803604
LoongArch: KVM: Make vcpu_is_preempted() as a macro rather than function

vcpu_is_preempted() is performance sensitive that called in function
osq_lock(), here make it as a macro. So that parameter is not parsed
at most time, it can avoid cache line thrashing across numa nodes.

Here is part of UnixBench result on Loongson-3C5000 DualWay machine with
32 cores and 2 numa nodes.

          original    inline   macro
execl     7025.7      6991.2   7242.3
fstime    474.6       703.1    1071

From the test result, making vcpu_is_preempted() as a macro is the best,
and there is some improvment compared with the original function method.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/qspinlock.h
arch/loongarch/kernel/paravirt.c