]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: lapic: Clean up find_highest_vector() and count_vectors()
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Wed, 5 Sep 2012 10:30:01 +0000 (19:30 +0900)
committerMarcelo Tosatti <mtosatti@redhat.com>
Wed, 12 Sep 2012 16:38:23 +0000 (13:38 -0300)
commit5299ec0f085721392790b604f00c1cb20ad27ae9
tree8a8ef1bd20dd24b4181acab240906da6978c117f
parente303e1f8d7f90c1906d46218f37e7eac6f20a93b
KVM: x86: lapic: Clean up find_highest_vector() and count_vectors()

find_highest_vector() and count_vectors():
 - Instead of using magic values, define and use proper macros.

find_highest_vector():
 - Remove likely() which is there only for historical reasons and not
   doing correct branch predictions anymore.  Using such heuristics
   to optimize this function is not worth it now.  Let CPUs predict
   things instead.

 - Stop checking word[0] separately.  This was only needed for doing
   likely() optimization.

 - Use for loop, not while, to iterate over the register array to make
   the code clearer.

Note that we actually confirmed that the likely() did wrong predictions
by inserting debug code.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/lapic.c