Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCHv2 0/2] kprobes: Reduce registration lookup costs
@ 2026-11-22 20:02 Jiri Olsa
  2026-11-22 20:02 ` [PATCHv2 1/2] kprobes: Increase the kprobe hash table size Jiri Olsa
  2026-11-22 20:02 ` [PATCHv2 2/2] x86/kprobes: Use ftrace_location_range in __recover_probed_insn Jiri Olsa
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Olsa @ 2026-11-22 20:02 UTC (permalink / raw)
  To: Masami Hiramatsu, Naveen N Rao, David S. Miller
  Cc: Peter Zijlstra, Steven Rostedt, Ingo Molnar, x86,
	linux-trace-kernel, linux-kernel, bpf

hi,
this is a smaller follow up to the v1 series [1]. This version does
only partial fixes of what v1 addressed. Instead of the rbtree and
iterators, it makes the existing per-address lookups cheaper:

  - increase the kprobe hash table from 64 to 4096 buckets, so the
    get_kprobe() calls done for every byte or decoded instruction
    around the new probe walk short chains instead of 300+ entries
    per bucket with 20000 probes

  - use ftrace_location_range() in x86 __recover_probed_insn(), so we
    skip the symbol lookup ftrace_location() does for every decoded
    instruction that is not an ftrace location

Registering kprobes with the kprobe_many_example sample module [2] from
v1 in a KVM guest goes from 4.71s to 1.30s for 20000 probes and from
29.99s to 3.64s for 50000 probes with the hash table change, and the
ftrace change brings 20587 probes from 4.02s to 3.70s. Please check the
changelogs for more details, the first patch has numbers for different
hash table sizes.

v2 changes:
  - dropped the static_call/jump_label indexes and the kprobe rbtree
    and iterators [will be addressed later]
  - added hash table size increase and the ftrace_location_range
    change for __recover_probed_insn

thanks,
jirka


[1] https://lore.kernel.org/bpf/20261109194916.1089703-1-jolsa@kernel.org/                                                       
[2] https://lore.kernel.org/bpf/20261109195827.1091410-1-jolsa@kernel.org/           
---
Jiri Olsa (2):
      kprobes: Increase the kprobe hash table size
      x86/kprobes: Use ftrace_location_range in __recover_probed_insn

 arch/x86/kernel/kprobes/core.c | 6 +++++-
 include/linux/ftrace.h         | 4 ++++
 kernel/kprobes.c               | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-22 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 20:02 [PATCHv2 0/2] kprobes: Reduce registration lookup costs Jiri Olsa
2026-11-22 20:02 ` [PATCHv2 1/2] kprobes: Increase the kprobe hash table size Jiri Olsa
2026-11-22 20:02 ` [PATCHv2 2/2] x86/kprobes: Use ftrace_location_range in __recover_probed_insn Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox