]> git.kernelconcepts.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>
Sat, 23 Mar 2013 02:32:56 +0000 (13:32 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 26 Mar 2013 05:11:38 +0000 (16:11 +1100)
commitb28377934244ef3a2ba3a3ad17e426592aac3090
treec8f557e72c2326ad1991f31b823d91429f8c78d1
parentcf9c18bf597007f136cc5df9f13c8e6a1da846e7
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