]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kernel/pid.c: improve flow of a loop inside alloc_pidmap.
authorRaphael S. Carvalho <raphael.scarv@gmail.com>
Tue, 26 Mar 2013 23:26:04 +0000 (10:26 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Apr 2013 06:26:28 +0000 (17:26 +1100)
commit8545025a98bfbfdcb5eeeeb19f4029424059252c
treeb53b99b3f631cf44296655060e697eab2087e9ed
parentde889af1a0193058194e24e15e315afedfeffca9
kernel/pid.c: improve flow of a loop inside alloc_pidmap.

find_next_offset() searches for an available "cleaned bit" in the
respective pid bitmap (page), so returns the offset if found, otherwise it
returns a value equals to BITS_PER_PAGE.

For example, suppose find_next_offset didn't find any available bit, so
there's no purpose to call mk_pid (Wasteful Cpu Cycles).

Therefore, I found it could be better to call mk_pid after the checking
(offset < BITS_PER_PAGE) returned sucessfully!  Another point: If (offset
< BITS_PER_PAGE) results in a "failure", then mk_pid would be called again
afterwards.

Signed-off-by: Raphael S. Carvalho <raphael.scarv@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/pid.c