Skip to contentSkip to conversation

ipc/sem.c: shrink size of struct sem_undo

PATCH New Konstantin Khlebnikov 1 participant 1 message Jul 7, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc/sem.c: shrink size of struct sem_undo

Combine ->list_id and ->rcu fields,
this is safe because this list is not rcu protected. This change reduce sizeof(struct sem_undo) from 72 to 54 bytes, so for small sem-arrays now sem_undo will fit into slab-64.

---
 include/linux/sem.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
include/linux/sem.h +4 -2
index f2961af..f6e0433 100644
@@ -122,9 +122,11 @@ struct sem_queue {
 struct sem_undo {
 	struct list_head	list_proc;	/* per-process list: all undos from one process. */
 						/* rcu protected */
-	struct rcu_head		rcu;		/* rcu struct for sem_undo() */
+	union {
+		struct list_head list_id;	/* per semaphore array list: all undos for one array */
+		struct rcu_head	 rcu;		/* rcu struct for sem_undo() */
+	};
 	struct sem_undo_list	*ulp;		/* sem_undo_list for the process */
-	struct list_head	list_id;	/* per semaphore array list: all undos for one array */
 	int			semid;		/* semaphore set identifier */
 	short *			semadj;		/* array of adjustments, one per semaphore */
 };