diff options
author | Suren Baghdasaryan <surenb@google.com> | 2024-11-22 09:44:15 -0800 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2024-12-02 12:01:38 +0100 |
commit | eb449bd96954b1c1e491d19066cfd2a010f0aa47 (patch) | |
tree | 1fd8c4cad86a3f37e4989a70489051e3f34d1f21 /mm/init-mm.c | |
parent | 7528585290a1a1d4e0fb4b72261eb2d8c85de2d7 (diff) |
mm: convert mm_lock_seq to a proper seqcount
Convert mm_lock_seq to be seqcount_t and change all mmap_write_lock
variants to increment it, in-line with the usual seqcount usage pattern.
This lets us check whether the mmap_lock is write-locked by checking
mm_lock_seq.sequence counter (odd=locked, even=unlocked). This will be
used when implementing mmap_lock speculation functions.
As a result vm_lock_seq is also change to be unsigned to match the type
of mm_lock_seq.sequence.
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Link: https://lkml.kernel.org/r/20241122174416.1367052-2-surenb@google.com
Diffstat (limited to 'mm/init-mm.c')
-rw-r--r-- | mm/init-mm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/init-mm.c b/mm/init-mm.c index 24c809379274..6af3ad675930 100644 --- a/mm/init-mm.c +++ b/mm/init-mm.c @@ -40,7 +40,7 @@ struct mm_struct init_mm = { .arg_lock = __SPIN_LOCK_UNLOCKED(init_mm.arg_lock), .mmlist = LIST_HEAD_INIT(init_mm.mmlist), #ifdef CONFIG_PER_VMA_LOCK - .mm_lock_seq = 0, + .mm_lock_seq = SEQCNT_ZERO(init_mm.mm_lock_seq), #endif .user_ns = &init_user_ns, .cpu_bitmap = CPU_BITS_NONE, |