]> git.baikalelectronics.ru Git - kernel.git/commit
perf/hw_breakpoint: Optimize constant number of breakpoint slots
authorMarco Elver <elver@google.com>
Mon, 29 Aug 2022 12:47:11 +0000 (14:47 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 30 Aug 2022 08:56:22 +0000 (10:56 +0200)
commit1d810b4387fe59329ff8c6b01640ed16a9d772a1
tree9f5c1c891387d7fc348507d23fd8b89f3d883cec
parentd70a5cea75970fceaf7b80e6ace63cacad6138da
perf/hw_breakpoint: Optimize constant number of breakpoint slots

Optimize internal hw_breakpoint state if the architecture's number of
breakpoint slots is constant. This avoids several kmalloc() calls and
potentially unnecessary failures if the allocations fail, as well as
subtly improves code generation and cache locality.

The protocol is that if an architecture defines hw_breakpoint_slots via
the preprocessor, it must be constant and the same for all types.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20220829124719.675715-7-elver@google.com
arch/sh/include/asm/hw_breakpoint.h
arch/x86/include/asm/hw_breakpoint.h
kernel/events/hw_breakpoint.c