All of lore.kernel.org
 help / color / mirror / Atom feed
* + ipc-only-destroy-orphaned-shm-segments-on-sysctl-write.patch added to mm-nonmm-unstable branch
@ 2026-06-25 23:06 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-06-25 23:06 UTC (permalink / raw)
  To: mm-commits, ebiederm, dave, shijianlin11, akpm


The patch titled
     Subject: ipc: only destroy orphaned shm segments on sysctl write
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     ipc-only-destroy-orphaned-shm-segments-on-sysctl-write.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/ipc-only-destroy-orphaned-shm-segments-on-sysctl-write.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Jianlin Shi <shijianlin11@foxmail.com>
Subject: ipc: only destroy orphaned shm segments on sysctl write
Date: Mon, 15 Jun 2026 10:27:41 +0800

proc_ipc_dointvec_minmax_orphans() currently calls shm_destroy_orphaned()
whenever shm_rmid_forced is set, including on sysctl reads.  Reading
/proc/sys/kernel/shm_rmid_forced should not take shm_ids rwsem for write
and walk all segments.

Only run the cleanup when the sysctl is written and the forced RMID policy
is enabled.

When shm_rmid_forced=1, monitoring tools that read
/proc/sys/kernel/shm_rmid_forced trigger the cleanup on every read.

Link: https://lore.kernel.org/all/?q=only+destroy+orphaned+shm+segments+on+sysctl+write
Link: https://lore.kernel.org/tencent_738A8BC6E9EA205F555E4B0DAA154D4F8E0A@qq.com
Signed-off-by: Jianlin Shi <shijianlin11@foxmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 ipc/ipc_sysctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/ipc/ipc_sysctl.c~ipc-only-destroy-orphaned-shm-segments-on-sysctl-write
+++ a/ipc/ipc_sysctl.c
@@ -28,7 +28,7 @@ static int proc_ipc_dointvec_minmax_orph
 
 	if (err < 0)
 		return err;
-	if (ns->shm_rmid_forced)
+	if (write && ns->shm_rmid_forced)
 		shm_destroy_orphaned(ns);
 	return err;
 }
_

Patches currently in -mm which might be from shijianlin11@foxmail.com are

ipc-only-destroy-orphaned-shm-segments-on-sysctl-write.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-25 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 23:06 + ipc-only-destroy-orphaned-shm-segments-on-sysctl-write.patch added to mm-nonmm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.