From: André Goddard Rosa Date: Wed, 16 Dec 2009 00:47:40 +0000 (-0800) Subject: pid: reduce code size by using a pointer to iterate over array X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=417e315247ebc199d357855bb08d2a5264400565;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Pekka Enberg Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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) for (type = 0; type < PIDTYPE_MAX; ++type) INIT_HLIST_HEAD(&pid->tasks[type]); + upid = pid->numbers + ns->level; spin_lock_irq(&pidmap_lock); - for (i = ns->level; i >= 0; i--) { - upid = &pid->numbers[i]; + for ( ; upid >= pid->numbers; --upid) hlist_add_head_rcu(&upid->pid_chain, &pid_hash[pid_hashfn(upid->nr, upid->ns)]); - } spin_unlock_irq(&pidmap_lock); out: