[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241121124011.GK24774@noisy.programming.kicks-ass.net>
Date: Thu, 21 Nov 2024 13:40:11 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Andrii Nakryiko <andrii@...nel.org>
Cc: linux-trace-kernel@...r.kernel.org, linux-mm@...ck.org,
akpm@...ux-foundation.org, oleg@...hat.com, rostedt@...dmis.org,
mhiramat@...nel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org, jolsa@...nel.org, paulmck@...nel.org,
willy@...radead.org, surenb@...gle.com, mjguzik@...il.com,
brauner@...nel.org, jannh@...gle.com, mhocko@...nel.org,
vbabka@...e.cz, shakeel.butt@...ux.dev, hannes@...xchg.org,
Liam.Howlett@...cle.com, lorenzo.stoakes@...cle.com,
david@...hat.com, arnd@...db.de, richard.weiyang@...il.com,
zhangpeng.00@...edance.com, linmiaohe@...wei.com,
viro@...iv.linux.org.uk, hca@...ux.ibm.com
Subject: Re: [PATCH v4 tip/perf/core 1/4] mm: Convert mm_lock_seq to a proper
seqcount
On Sun, Oct 27, 2024 at 06:08:15PM -0700, Andrii Nakryiko wrote:
> +/*
> + * 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.
> + mm_lock_seqcount_end(mm);
> +}
Powered by blists - more mailing lists