[PATCH v2 3/3] ipc/sem: remove obsolete SEMOPM fragmentation warning
From: Yingjie Wang
Date: Thu Oct 22 2026 - 23:20:11 EST
The UAPI comment advises keeping SEMOPM at or below 1000 because a larger
operation array may fail due to physical memory fragmentation.
Commit e4243b8062c1 ("ipc/sem: play nicer with large nsops allocations")
changed the operation array to kvmalloc() specifically to support larger
configured limits, with vmalloc fallback when a physically contiguous
allocation is unavailable.
Replace the obsolete warning with a description of the compiled-in
default and the runtime sysctl.
Signed-off-by: Yingjie Wang <x-professor@xxxxxxxxxxx>
---
include/uapi/linux/sem.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h
index 75aa3b273cd99..cfd772f4c3396 100644
--- a/include/uapi/linux/sem.h
+++ b/include/uapi/linux/sem.h
@@ -71,16 +71,15 @@ struct seminfo {
* The values has been chosen to be larger than necessary for any
* known configuration.
*
- * SEMOPM should not be increased beyond 1000, otherwise there is the
- * risk that semop()/semtimedop() fails due to kernel memory fragmentation when
- * allocating the sop array.
+ * SEMOPM is the default maximum number of operations per semop() call. The
+ * runtime limit can be changed through /proc/sys/kernel/sem.
*/
#define SEMMNI 32000 /* <= IPCMNI max # of semaphore identifiers */
#define SEMMSL 32000 /* <= INT_MAX max num of semaphores per id */
#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
-#define SEMOPM 500 /* <= 1 000 max num of ops per semop call */
+#define SEMOPM 500 /* default max num of ops per semop call */
#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
#define SEMAEM SEMVMX /* adjust on exit max value */
--
2.43.0