Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit ed14b49

Browse files
author
Quentin Perret
committed
ANDROID: KVM: arm64: Fix accounting of pinned THPs with pKVM
When faulting in a THP, we proactively account the entire huge page against RLIMIT_MEMLOCK before trying to map it. However, if we happen to find an already mapped page in the THP range after that, we retry to fault at page granularity instead and fixup the accounting accordingly. Unfortunately the fixing of the accounting is done incorrectly -- we only substract PAGE_SIZE instead of the full HP size. Fix that. Bug: 278749606 Bug: 278011447 Change-Id: I20498c42fcba6efa2c80cb63057bbada6ad8fa87 Signed-off-by: Quentin Perret <[email protected]>
1 parent 7a3007d commit ed14b49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/kvm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,8 +1769,8 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t *fault_ipa,
17691769
*fault_ipa += pmd_offset;
17701770
pfn += pmd_offset >> PAGE_SHIFT;
17711771
page = pfn_to_page(pfn);
1772-
page_size = PAGE_SIZE;
17731772
account_locked_vm(mm, page_size >> PAGE_SHIFT, false);
1773+
page_size = PAGE_SIZE;
17741774
goto retry;
17751775
}
17761776

0 commit comments

Comments
 (0)