Re: [PATCH v4 tip/perf/core 1/4] mm: Convert mm_lock_seq to a proper seqcount
From: Suren Baghdasaryan <surenb@google.com>
Date: 2024-11-21 15:35:25
Also in:
bpf, linux-mm, lkml
From: Suren Baghdasaryan <surenb@google.com>
Date: 2024-11-21 15:35:25
Also in:
bpf, linux-mm, lkml
On Thu, Nov 21, 2024 at 4:40 AM Peter Zijlstra [off-list ref] wrote:
On Sun, Oct 27, 2024 at 06:08:15PM -0700, Andrii Nakryiko wrote:quoted
+/* + * Drop all currently-held per-VMA locks. + * This is called from the mmap_lock implementation directly before releasing + * a write-locked mmap_lock (or downgrading it to read-locked). + * This should normally NOT be called manually from other places. + * If you want to call this manually anyway, keep in mind that this will release + * *all* VMA write locks, including ones from further up the stack. + */ +static inline void vma_end_write_all(struct mm_struct *mm) +{ + mmap_assert_write_locked(mm); + /* + * Nobody can concurrently modify mm->mm_lock_seq due to exclusive + * mmap_lock being held. + */You can write: ASSERT_EXCLUSIVE_WRITER(mm->mm_lock_seq); instead of that comment. Then KCSAN will validate the claim.
Thanks for the tip! This one looks not critical but I see there are
more important comments in "mm: Introduce
mmap_lock_speculation_{begin|end}". I'll send a new version shortly.
quoted
+ mm_lock_seqcount_end(mm); +}