diff options
author | André Goddard Rosa <andre.goddard@gmail.com> | 2009-12-15 19:47:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:20:12 -0500 |
commit | 417e315247ebc199d357855bb08d2a5264400565 (patch) | |
tree | 84383762d1abaebaa00928bbfc23851742d9cf9b /kernel | |
parent | 7be6d991bca63bbcdc5bc3b09789f367a3486537 (diff) |
pid: reduce code size by using a pointer to iterate over array
It decreases code size by 16 bytes on my gcc 4.4.1 on Core 2:
text data bss dec hex filename
4314 2216 8 6538 198a kernel/pid.o-BEFORE
4298 2216 8 6522 197a kernel/pid.o-AFTER
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/pid.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 55fd5900bac8..2e17c9c92cbe 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -269,12 +269,11 @@ struct pid *alloc_pid(struct pid_namespace *ns) | |||
269 | for (type = 0; type < PIDTYPE_MAX; ++type) | 269 | for (type = 0; type < PIDTYPE_MAX; ++type) |
270 | INIT_HLIST_HEAD(&pid->tasks[type]); | 270 | INIT_HLIST_HEAD(&pid->tasks[type]); |
271 | 271 | ||
272 | upid = pid->numbers + ns->level; | ||
272 | spin_lock_irq(&pidmap_lock); | 273 | spin_lock_irq(&pidmap_lock); |
273 | for (i = ns->level; i >= 0; i--) { | 274 | for ( ; upid >= pid->numbers; --upid) |
274 | upid = &pid->numbers[i]; | ||
275 | hlist_add_head_rcu(&upid->pid_chain, | 275 | hlist_add_head_rcu(&upid->pid_chain, |
276 | &pid_hash[pid_hashfn(upid->nr, upid->ns)]); | 276 | &pid_hash[pid_hashfn(upid->nr, upid->ns)]); |
277 | } | ||
278 | spin_unlock_irq(&pidmap_lock); | 277 | spin_unlock_irq(&pidmap_lock); |
279 | 278 | ||
280 | out: | 279 | out: |