pidns: make pid->level and pid_ns->level unsigned
authorPavel Emelyanov <xemul@openvz.org>
Wed, 30 Apr 2008 07:54:31 +0000 (00:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 30 Apr 2008 15:29:49 +0000 (08:29 -0700)
These values represent the nesting level of a namespace and pids living in it,
and it's always non-negative.

Turning this from int to unsigned int saves some space in pid.c (11 bytes on
x86 and 64 on ia64) by letting the compiler optimize the pid_nr_ns a bit.
E.g.  on ia64 this removes the sign extension calls, which compiler adds to
optimize access to pid->nubers[ns->level].

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/pid.h
include/linux/pid_namespace.h
kernel/pid_namespace.c

index 8d199033c0ca01feff307223ec7dd570fea1bcc7..c21c7e8124a7bb7bde92937fc37cf0810598d091 100644 (file)
@@ -60,7 +60,7 @@ struct pid
        /* lists of tasks that use this pid */
        struct hlist_head tasks[PIDTYPE_MAX];
        struct rcu_head rcu;
-       int level;
+       unsigned int level;
        struct upid numbers[1];
 };
 
index fcd61fa2c833e415ab823e03532bd4880b16be79..caff5283d15c6e11fe838ffad6b2877077af490e 100644 (file)
@@ -20,7 +20,7 @@ struct pid_namespace {
        int last_pid;
        struct task_struct *child_reaper;
        struct kmem_cache *pid_cachep;
-       int level;
+       unsigned int level;
        struct pid_namespace *parent;
 #ifdef CONFIG_PROC_FS
        struct vfsmount *proc_mnt;
index 5ca37fa50beb5b4d66b79e9c596943c80d363dfc..98702b4b8851762969d9ddad76505e5739e8166c 100644 (file)
@@ -66,7 +66,7 @@ err_alloc:
        return NULL;
 }
 
-static struct pid_namespace *create_pid_namespace(int level)
+static struct pid_namespace *create_pid_namespace(unsigned int level)
 {
        struct pid_namespace *ns;
        int i;