From baf8f0f82dd79e374bf6fa9e996393df2bae3c21 Mon Sep 17 00:00:00 2001 From: Pavel Emelianov Date: Thu, 18 Oct 2007 23:39:48 -0700 Subject: pid namespaces: dynamic kmem cache allocator for pid namespaces Add kmem_cache to pid_namespace to allocate pids from. Since both implementations expand the struct pid to carry more numerical values each namespace should have separate cache to store pids of different sizes. Each kmem cache is name "pid_", where is the number of numerical ids on the pid. Different namespaces with same level of nesting will have same caches. This patch has two FIXMEs that are to be fixed after we reach the consensus about the struct pid itself. The first one is that the namespace to free the pid from in free_pid() must be taken from pid. Now the init_pid_ns is used. The second FIXME is about the cache allocation. When we do know how long the object will be then we'll have to calculate this size in create_pid_cachep. Right now the sizeof(struct pid) value is used. [akpm@linux-foundation.org: coding-style repair] Signed-off-by: Pavel Emelianov Acked-by: Cedric Le Goater Acked-by: Sukadev Bhattiprolu Cc: Kirill Korotaev Cc: "Eric W. Biederman" Cc: Herbert Poetzl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/pid_namespace.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux/pid_namespace.h') diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index ddb9a4c9596..c471c0c6e9c 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -20,6 +20,7 @@ struct pid_namespace { struct pidmap pidmap[PIDMAP_ENTRIES]; int last_pid; struct task_struct *child_reaper; + struct kmem_cache *pid_cachep; }; extern struct pid_namespace init_pid_ns; -- cgit v1.2.2