• Pavel Emelianov's avatar
    pid namespaces: dynamic kmem cache allocator for pid namespaces · baf8f0f8
    Pavel Emelianov authored
    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_<NR>", where <NR> 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: default avatarPavel Emelianov <xemul@openvz.org>
    Acked-by: default avatarCedric Le Goater <clg@fr.ibm.com>
    Acked-by: default avatarSukadev Bhattiprolu <sukadev@us.ibm.com>
    Cc: Kirill Korotaev <dev@openvz.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Herbert Poetzl <herbert@13thfloor.at>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    baf8f0f8
pid_namespace.h 1.01 KB