summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorQuentin Perret <qperret@google.com>2021-12-08 15:22:54 +0000
committerMarc Zyngier <maz@kernel.org>2021-12-15 14:16:28 +0000
commit34b43a8849229e8363c19236ecdf463b7a89d085 (patch)
treeb2354d8ac484680e2e30389fe00480c365c2c456 /arch/arm64/kvm
parentd58071a8a76d779eedab38033ae4c821c30295a5 (diff)
downloadlinux-34b43a8849229e8363c19236ecdf463b7a89d085.tar.gz
linux-34b43a8849229e8363c19236ecdf463b7a89d085.tar.bz2
linux-34b43a8849229e8363c19236ecdf463b7a89d085.zip
KVM: arm64: pkvm: Fix hyp_pool max order
The EL2 page allocator in protected mode maintains a per-pool max order value to optimize allocations when the memory region it covers is small. However, the max order value is currently under-estimated whenever the number of pages in the region is a power of two. Fix the estimation. Signed-off-by: Quentin Perret <qperret@google.com> Acked-by: Will Deacon <will@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20211208152300.2478542-2-qperret@google.com
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/hyp/nvhe/page_alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/page_alloc.c b/arch/arm64/kvm/hyp/nvhe/page_alloc.c
index 0bd7701ad1df..543cad6c376a 100644
--- a/arch/arm64/kvm/hyp/nvhe/page_alloc.c
+++ b/arch/arm64/kvm/hyp/nvhe/page_alloc.c
@@ -241,7 +241,7 @@ int hyp_pool_init(struct hyp_pool *pool, u64 pfn, unsigned int nr_pages,
int i;
hyp_spin_lock_init(&pool->lock);
- pool->max_order = min(MAX_ORDER, get_order(nr_pages << PAGE_SHIFT));
+ pool->max_order = min(MAX_ORDER, get_order((nr_pages + 1) << PAGE_SHIFT));
for (i = 0; i < pool->max_order; i++)
INIT_LIST_HEAD(&pool->free_area[i]);
pool->range_start = phys;