selftests-mm-vm_util-add-helpers-to-set-and-restore-shm-limits.patch removed from -mm tree
The quilt patch titled
Subject: selftests/mm: vm_util: add helpers to set and restore shm limits
has been removed from the -mm tree. Its filename was
selftests-mm-vm_util-add-helpers-to-set-and-restore-shm-limits.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: "Mike Rapoport (Microsoft)" <[email protected]>
Subject: selftests/mm: vm_util: add helpers to set and restore shm limits
Date: Mon, 11 May 2026 19:28:14 +0300
hugetlb-shm and thuge-gen tests require that limits defined by /proc/sys/kernel/{shmmax,shmall} should be higher than certain values.
Add helpers that allow setting these limits and restoring their settings on a test exit.
They will be used later in hugetlb-shm and thuge-gen.
---
tools/testing/selftests/mm/vm_util.c | 28 +++++++++++++++++++++++++ tools/testing/selftests/mm/vm_util.h | 9 ++++++++ 2 files changed, 37 insertions(+)
tools/testing/selftests/mm/vm_util.c renamed from tools/testing/selftests/mm/vm_util.c~selftests-mm-vm_util-add-helpers-to-set-and-restore-shm-limits +28 -0
@@ -760,3 +760,31 @@ void write_num(const char *path, unsignesprintf (buf,"%lu" , num);write_file (path, buf,strlen (buf) +1 ); } + +static unsigned long shmall, shmmax; + +void __shm_limits_restore (void ) +{ +if (shmmax) +write_num ("/proc/sys/kernel/shmmax" , shmmax); +if (shmall) +write_num ("/proc/sys/kernel/shmall" , shmall); +} + +void shm_limits_prepare (unsigned long length) +{ +unsigned long nr = length /psize (); +unsigned long val; + + val =read_num ("/proc/sys/kernel/shmmax" ); +if (val < length) { +write_num ("/proc/sys/kernel/shmmax" , length); + shmmax = val; + } + + val =read_num ("/proc/sys/kernel/shmall" ); +if (val < nr) { +write_num ("/proc/sys/kernel/shmall" , nr); + shmall = val; + } +}
tools/testing/selftests/mm/vm_util.h renamed from tools/testing/selftests/mm/vm_util.h~selftests-mm-vm_util-add-helpers-to-set-and-restore-shm-limits +9 -0
@@ -168,3 +168,12 @@ void write_file(const char *path, constint read_file (const char *path,char *buf,size_t buflen);unsigned long read_num (const char *path);void write_num (const char *path,unsigned long num); + +void shm_limits_prepare (unsigned long length); +void __shm_limits_restore (void ); + +#define SHM_LIMITS_RESTORE () \ +static void __attribute__((destructor)) shm_limits_restore(void) \ +{ \ + __shm_limits_restore(); \ +}
_
Patches currently in -mm which might be from [email protected] are