]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm: abstract reading sysctl_max_map_count, and READ_ONCE()
authorLorenzo Stoakes (Oracle) <ljs@kernel.org>
Wed, 11 Mar 2026 17:24:37 +0000 (17:24 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:28 +0000 (13:53 -0700)
commit2d1e54aab6fd01f7502af20e125312e06a15bf9c
treeed7675c9ded1fe21974dcf65f93b27598435809b
parent9b9b8d4aebf1eb8fe22293dcfc38c600a7e7859b
mm: abstract reading sysctl_max_map_count, and READ_ONCE()

Concurrent reads and writes of sysctl_max_map_count are possible, so we
should READ_ONCE() and WRITE_ONCE().

The sysctl procfs logic already enforces WRITE_ONCE(), so abstract the
read side with get_sysctl_max_map_count().

While we're here, also move the field to mm/internal.h and add the getter
there since only mm interacts with it, there's no need for anybody else to
have access.

Finally, update the VMA userland tests to reflect the change.

Link: https://lkml.kernel.org/r/0715259eb37cbdfde4f9e5db92a20ec7110a1ce5.1773249037.git.ljs@kernel.org
Signed-off-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Cc: Jann Horn <jannh@google.com>
Cc: Jianzhou Zhao <luckd0g@163.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mm.h
mm/internal.h
mm/mmap.c
mm/mremap.c
mm/nommu.c
mm/vma.c
tools/testing/vma/include/custom.h
tools/testing/vma/include/dup.h
tools/testing/vma/main.c