Re: [PATCH v2 tip/perf/core 1/5] mm: introduce mmap_lock_speculation_{start|end}
From: Andrii Nakryiko
Date: Mon Oct 07 2024 - 13:05:38 EST
+cc Liam, sorry, seems like I forgot to add you to the entire patch
set on initial submission.
On Tue, Oct 1, 2024 at 3:52 PM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote:
>
> From: Suren Baghdasaryan <surenb@xxxxxxxxxx>
>
> Add helper functions to speculatively perform operations without
> read-locking mmap_lock, expecting that mmap_lock will not be
> write-locked and mm is not modified from under us.
>
> Suggested-by: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> Link: https://lore.kernel.org/bpf/20240912210222.186542-1-surenb@xxxxxxxxxx
> ---
> include/linux/mm_types.h | 3 ++
> include/linux/mmap_lock.h | 72 ++++++++++++++++++++++++++++++++-------
> kernel/fork.c | 3 --
> 3 files changed, 63 insertions(+), 15 deletions(-)
>
Are memory-management folks OK with these changes? It would be nice to
get some acks, if so, and I'd include it into respin, fixing minor
things in uprobe patches. Thank you!
Note, while this is initially needed for uprobe functionality, having
an ability to quickly change whether mm_struct changed inbetween some
speculative querying is generally useful functionality, and I believe
it would help eliminating mmap_lock usage from /proc/PID/maps code.
Which is a great outcome for everyone, as that mmap_lock can be quite
disruptive in production workloads.
So please don't see it as some irrelevant uprobe-related requirement,
the applicability of this is much wider.
[...]