]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
powerpc64/bpf: Inline bpf_get_smp_processor_id() and bpf_get_current_task/_btf()
authorSaket Kumar Bhaskar <skb99@linux.ibm.com>
Wed, 10 Dec 2025 06:50:33 +0000 (12:20 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Wed, 7 Jan 2026 04:02:40 +0000 (09:32 +0530)
commit20ab1d11265350a9ea3d315d6c70170b8198f329
tree0e3264443ecdeb3f2dd89580d06e1bf932ed1ac3
parent58a075adf3fb1701435d29e0113284dc31d6e43e
powerpc64/bpf: Inline bpf_get_smp_processor_id() and bpf_get_current_task/_btf()

Inline the calls to bpf_get_smp_processor_id() and bpf_get_current_task/_btf()
in the powerpc bpf jit.

powerpc saves the Logical processor number (paca_index) and pointer
to current task (__current) in paca.

Here is how the powerpc JITed assembly changes after this commit:

Before:

cpu = bpf_get_smp_processor_id();

addis 12, 2, -517
addi 12, 12, -29456
mtctr 12
bctrl
mr 8, 3

After:

cpu = bpf_get_smp_processor_id();

lhz 8, 8(13)

To evaluate the performance improvements introduced by this change,
the benchmark described in [1] was employed.

+---------------+-------------------+-------------------+--------------+
|      Name     |      Before       |        After      |   % change   |
|---------------+-------------------+-------------------+--------------|
| glob-arr-inc  | 40.701 ± 0.008M/s | 55.207 ± 0.021M/s |   + 35.64%   |
| arr-inc       | 39.401 ± 0.007M/s | 56.275 ± 0.023M/s |   + 42.42%   |
| hash-inc      | 24.944 ± 0.004M/s | 26.212 ± 0.003M/s |   +  5.08%   |
+---------------+-------------------+-------------------+--------------+

[1] https://github.com/anakryiko/linux/commit/8dec900975ef

Reviewed-by: Puranjay Mohan <puranjay@kernel.org>
Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com>
Acked-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/89abfdd6f6721fbe7897865e74f2f691e5f7824a.1765343385.git.skb99@linux.ibm.com
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/net/bpf_jit_comp64.c