diff options
author | Pierre Peiffer <pierre.peiffer@bull.net> | 2008-02-08 07:18:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:26 -0500 |
commit | ed2ddbf88c0ddeeae4c78bb306a116dfd867c55c (patch) | |
tree | de6d6828c03f98be6fc41e8acf3b3e52df28be9b /ipc/util.c | |
parent | 4b9fcb0ec60584d639ad105c42b75a3447071e47 (diff) |
IPC: make struct ipc_ids static in ipc_namespace
Each ipc_namespace contains a table of 3 pointers to struct ipc_ids (3 for
msg, sem and shm, structure used to store all ipcs) These 'struct ipc_ids'
are dynamically allocated for each icp_namespace as the ipc_namespace
itself (for the init namespace, they are initialized with pointers to
static variables instead)
It is so for historical reason: in fact, before the use of idr to store the
ipcs, the ipcs were stored in tables of variable length, depending of the
maximum number of ipc allowed. Now, these 'struct ipc_ids' have a fixed
size. As they are allocated in any cases for each new ipc_namespace, there
is no gain of memory in having them allocated separately of the struct
ipc_namespace.
This patch proposes to make this table static in the struct ipc_namespace.
Thus, we can allocate all in once and get rid of all the code needed to
allocate and free these ipc_ids separately.
Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Acked-by: Cedric Le Goater <clg@fr.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/util.c')
-rw-r--r-- | ipc/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ipc/util.c b/ipc/util.c index 910db7748199..fd1b50da9db8 100644 --- a/ipc/util.c +++ b/ipc/util.c | |||
@@ -833,7 +833,7 @@ static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos) | |||
833 | if (ipc && ipc != SEQ_START_TOKEN) | 833 | if (ipc && ipc != SEQ_START_TOKEN) |
834 | ipc_unlock(ipc); | 834 | ipc_unlock(ipc); |
835 | 835 | ||
836 | return sysvipc_find_ipc(iter->ns->ids[iface->ids], *pos, pos); | 836 | return sysvipc_find_ipc(&iter->ns->ids[iface->ids], *pos, pos); |
837 | } | 837 | } |
838 | 838 | ||
839 | /* | 839 | /* |
@@ -846,7 +846,7 @@ static void *sysvipc_proc_start(struct seq_file *s, loff_t *pos) | |||
846 | struct ipc_proc_iface *iface = iter->iface; | 846 | struct ipc_proc_iface *iface = iter->iface; |
847 | struct ipc_ids *ids; | 847 | struct ipc_ids *ids; |
848 | 848 | ||
849 | ids = iter->ns->ids[iface->ids]; | 849 | ids = &iter->ns->ids[iface->ids]; |
850 | 850 | ||
851 | /* | 851 | /* |
852 | * Take the lock - this will be released by the corresponding | 852 | * Take the lock - this will be released by the corresponding |
@@ -877,7 +877,7 @@ static void sysvipc_proc_stop(struct seq_file *s, void *it) | |||
877 | if (ipc && ipc != SEQ_START_TOKEN) | 877 | if (ipc && ipc != SEQ_START_TOKEN) |
878 | ipc_unlock(ipc); | 878 | ipc_unlock(ipc); |
879 | 879 | ||
880 | ids = iter->ns->ids[iface->ids]; | 880 | ids = &iter->ns->ids[iface->ids]; |
881 | /* Release the lock we took in start() */ | 881 | /* Release the lock we took in start() */ |
882 | up_read(&ids->rw_mutex); | 882 | up_read(&ids->rw_mutex); |
883 | } | 883 | } |