Skip to content

Commit

Permalink
pidns: make pid->level and pid_ns->level unsigned
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xemul authored and torvalds committed Apr 30, 2008
1 parent ab883af commit caafa43
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/linux/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

Expand Down
2 changes: 1 addition & 1 deletion include/linux/pid_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion kernel/pid_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static struct kmem_cache *create_pid_cachep(int nr_ids)
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;
Expand Down

0 comments on commit caafa43

Please sign in to comment.