]> www.infradead.org Git - users/willy/xarray.git/commit
uprobes: protected uprobe lifetime with SRCU
authorAndrii Nakryiko <andrii@kernel.org>
Tue, 3 Sep 2024 17:45:57 +0000 (10:45 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 5 Sep 2024 14:56:13 +0000 (16:56 +0200)
commit8617408f7a01e94ce1f73e40a7704530e5dfb25c
tree99df1ffa0909231d70f80b274512d789a48d55f6
parent3f7f1a64da731749f1bbd7424b44c1ec6191f21c
uprobes: protected uprobe lifetime with SRCU

To avoid unnecessarily taking a (brief) refcount on uprobe during
breakpoint handling in handle_swbp for entry uprobes, make find_uprobe()
not take refcount, but protect the lifetime of a uprobe instance with
RCU. This improves scalability, as refcount gets quite expensive due to
cache line bouncing between multiple CPUs.

Specifically, we utilize our own uprobe-specific SRCU instance for this
RCU protection. put_uprobe() will delay actual kfree() using call_srcu().

For now, uretprobe and single-stepping handling will still acquire
refcount as necessary. We'll address these issues in follow up patches
by making them use SRCU with timeout.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/r/20240903174603.3554182-3-andrii@kernel.org
kernel/events/uprobes.c