Skip to content

bpf: Move IPIs out of pack_mutex and reduce IBPB flushes

Xu Kuohai bpf lkml sashiko-reviews 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpf: Move bpf_arch_text_invalidate() out of pack_mutexkernel/bpf/core.c+10 -32 replies
2/3bpf: Change dirty tracking from packs to chunkskernel/bpf/core.c+64 -91 reply
3/3bpf: Move branch predictor flush out of pack_mutexkernel/bpf/core.c+61 -102 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] bpf: Move IPIs out of pack_mutex and reduce IBPB flushes

From: Xu Kuohai <[email protected]>

BPF JIT memory is allocated through the BPF program pack allocator, which uses a global pack_mutex to protect its packs. While holding this lock, the allocator currently sends IPI to all CPUs on two paths: IBPB flush on the x86 alloc path and CPU pipeline flush on the arm64 free path. Because the caller can be preempted while waiting for the IPI completion, the lock can be held for a long time, causing heavy lock contention on busy systems.

This series moves both IPI out of pack_mutex and tracks dirty state per chunk instead of per pack to reduce IBPB flushes.

Xu Kuohai (3):
bpf: Move bpf_arch_text_invalidate() out of pack_mutex
bpf: Change dirty tracking from packs to chunks
bpf: Move branch predictor flush out of pack_mutex

 kernel/bpf/core.c | 153 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 133 insertions(+), 20 deletions(-)
Signature · 1 line
2.47.3