Skip to contentSkip to conversation

ipc: comments for shm_forced_rmid code

PATCH New Vasiliy Kulikov 1 participant 1 message Jun 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc: comments for shm_forced_rmid code

shm_may_destroy() and ipc_namespace.shm_forced_rmid lack comments.

---
 include/linux/ipc_namespace.h |    3 +++
 ipc/shm.c                     |   10 ++++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)
include/linux/ipc_namespace.h +3 -0
index bec508f..74173c5 100644
@@ -44,6 +44,9 @@ struct ipc_namespace {
 	size_t		shm_ctlall;
 	int		shm_ctlmni;
 	int		shm_tot;
+
+	/* Defines whether IPC_RMID is forced for _all_ shm segments
+	 * regardless of shmctl() */
 	int		shm_forced_rmid;
 
 	struct notifier_block ipcns_nb;
ipc/shm.c +10 -0
index c55623c..22006f1 100644
@@ -187,6 +187,16 @@ static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
 	ipc_rcu_putref(shp);
 }
 
+/*
+ * shm_may_destroy - identifies whether shm segment should be destroyed now
+ *
+ * Returns true if and only if there are no active users of the segment and
+ * one of the following is true:
+ *
+ * 1) shmctl(id, IPC_RMID, NULL) was called for this shp
+ *
+ * 2) sysctl kernel.shm_forced_rmid is set to 1.
+ */
 static bool shm_may_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
 {
 	return (shp->shm_nattch == 0) &&
Signature · 1 line
1.7.0.4