diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-04-30 03:54:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:48 -0400 |
commit | b7127aa4547d8cc8a5b569631e2b6ef613af1bb7 (patch) | |
tree | b4a2ec699864c865c6286a48debfd13565ab4987 /kernel/pid.c | |
parent | 718a916338e821a10961e6a7a17430c18e5e58d9 (diff) |
free_pidmap: turn it into free_pidmap(struct upid *)
The callers of free_pidmap() pass 2 members of "struct upid", we can just
pass "struct upid *" instead. Shaves off 10 bytes from pid.o.
Also, simplify the alloc_pid's "out_free:" error path a little bit. This
way it looks more clear which subset of pid->numbers[] we are freeing.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc :Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/pid.c')
-rw-r--r-- | kernel/pid.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 477691576b33..b322cdf401bf 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -111,10 +111,11 @@ EXPORT_SYMBOL(is_container_init); | |||
111 | 111 | ||
112 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock); | 112 | static __cacheline_aligned_in_smp DEFINE_SPINLOCK(pidmap_lock); |
113 | 113 | ||
114 | static void free_pidmap(struct pid_namespace *pid_ns, int pid) | 114 | static void free_pidmap(struct upid *upid) |
115 | { | 115 | { |
116 | struct pidmap *map = pid_ns->pidmap + pid / BITS_PER_PAGE; | 116 | int nr = upid->nr; |
117 | int offset = pid & BITS_PER_PAGE_MASK; | 117 | struct pidmap *map = upid->ns->pidmap + nr / BITS_PER_PAGE; |
118 | int offset = nr & BITS_PER_PAGE_MASK; | ||
118 | 119 | ||
119 | clear_bit(offset, map->page); | 120 | clear_bit(offset, map->page); |
120 | atomic_inc(&map->nr_free); | 121 | atomic_inc(&map->nr_free); |
@@ -232,7 +233,7 @@ void free_pid(struct pid *pid) | |||
232 | spin_unlock_irqrestore(&pidmap_lock, flags); | 233 | spin_unlock_irqrestore(&pidmap_lock, flags); |
233 | 234 | ||
234 | for (i = 0; i <= pid->level; i++) | 235 | for (i = 0; i <= pid->level; i++) |
235 | free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr); | 236 | free_pidmap(pid->numbers + i); |
236 | 237 | ||
237 | call_rcu(&pid->rcu, delayed_put_pid); | 238 | call_rcu(&pid->rcu, delayed_put_pid); |
238 | } | 239 | } |
@@ -278,8 +279,8 @@ out: | |||
278 | return pid; | 279 | return pid; |
279 | 280 | ||
280 | out_free: | 281 | out_free: |
281 | for (i++; i <= ns->level; i++) | 282 | while (++i <= ns->level) |
282 | free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr); | 283 | free_pidmap(pid->numbers + i); |
283 | 284 | ||
284 | kmem_cache_free(ns->pid_cachep, pid); | 285 | kmem_cache_free(ns->pid_cachep, pid); |
285 | pid = NULL; | 286 | pid = NULL; |