mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									7be6d991bc
								
							
						
					
					
						commit
						417e315247
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		|  | @ -269,12 +269,11 @@ struct pid *alloc_pid(struct pid_namespace *ns) | ||||||
| 	for (type = 0; type < PIDTYPE_MAX; ++type) | 	for (type = 0; type < PIDTYPE_MAX; ++type) | ||||||
| 		INIT_HLIST_HEAD(&pid->tasks[type]); | 		INIT_HLIST_HEAD(&pid->tasks[type]); | ||||||
| 
 | 
 | ||||||
|  | 	upid = pid->numbers + ns->level; | ||||||
| 	spin_lock_irq(&pidmap_lock); | 	spin_lock_irq(&pidmap_lock); | ||||||
| 	for (i = ns->level; i >= 0; i--) { | 	for ( ; upid >= pid->numbers; --upid) | ||||||
| 		upid = &pid->numbers[i]; |  | ||||||
| 		hlist_add_head_rcu(&upid->pid_chain, | 		hlist_add_head_rcu(&upid->pid_chain, | ||||||
| 				&pid_hash[pid_hashfn(upid->nr, upid->ns)]); | 				&pid_hash[pid_hashfn(upid->nr, upid->ns)]); | ||||||
| 	} |  | ||||||
| 	spin_unlock_irq(&pidmap_lock); | 	spin_unlock_irq(&pidmap_lock); | ||||||
| 
 | 
 | ||||||
| out: | out: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 André Goddard Rosa
						André Goddard Rosa