]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: MMU: simplify last_pte_bitmap
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Feb 2016 11:51:19 +0000 (12:51 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Mar 2016 11:33:38 +0000 (12:33 +0100)
commit47b5d66b5aa7904f6f52a9ce3f31887bcad2df40
treec7023298fd90cabf3532b45afa31c03e71fdd604
parent4f58c54f74ee259b64c40f44776af3e4cfc73740
KVM: MMU: simplify last_pte_bitmap

Branch-free code is fun and everybody knows how much Avi loves it,
but last_pte_bitmap takes it a bit to the extreme.  Since the code
is simply doing a range check, like

(level == 1 ||
 ((gpte & PT_PAGE_SIZE_MASK) && level < N)

we can make it branch-free without storing the entire truth table;
it is enough to cache N.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c