--- ./include/linux/container.h.uids 2006-02-06 23:46:40.000000000 +0300 +++ ./include/linux/container.h 2006-02-07 00:05:33.000000000 +0300 @@ -6,11 +6,14 @@ #include struct task_struct; +struct list_head; struct container { u32 id; struct task_struct *init_task; atomic_t refcnt; + + struct list_head *c_uid_hash; }; extern struct container init_container; --- ./kernel/user.c.uids 2006-02-06 22:15:06.000000000 +0300 +++ ./kernel/user.c 2006-02-06 23:58:06.000000000 +0300 @@ -14,6 +14,7 @@ #include #include #include +#include /* * UID task count cache, to get fast user lookup in "alloc_uid" @@ -24,7 +25,12 @@ #define UIDHASH_SZ (1 << UIDHASH_BITS) #define UIDHASH_MASK (UIDHASH_SZ - 1) #define __uidhashfn(uid) (((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK) + +#ifdef CONFIG_CONTAINER +#define uidhashentry(uid) (econtainer()->c_uid_hash + __uidhashfn((uid))) +#else #define uidhashentry(uid) (uidhash_table + __uidhashfn((uid))) +#endif static kmem_cache_t *uid_cachep; static struct list_head uidhash_table[UIDHASH_SZ]; @@ -200,6 +206,9 @@ static int __init uid_cache_init(void) /* Insert the root user immediately (init already runs as root) */ spin_lock_irq(&uidhash_lock); +#ifdef CONFIG_CONTAINER + init_container.c_uid_hash = uidhash_table; +#endif uid_hash_insert(&root_user, uidhashentry(0)); spin_unlock_irq(&uidhash_lock);