Commit 346d7b18 authored by Vincent Donnefort's avatar Vincent Donnefort Committed by Treehugger Robot
Browse files

ANDROID: KVM: arm64: Fix reclaim offset into hyp_alloc



The amount of memory that is reclaimed from a single chunk is capped
(this can be due either by the limit set by the shrinker or by the
rate-limit of pages reclaimable in one HVC). Problem, the start address
of the region to be unmapped wasn't updated properly. This lead to a
BUG_ON() due to a double unmap.

e.g.

 hypervisor:
   void *ptr = hyp_alloc(PAGE_SIZE * 3);
   hyp_free(ptr); /* 4 pages reclaimable */

 host:
   echo 0 0 2 > /sys/kernel/debug/shrinker/pkvm*/scan
   ## Reclaim 2 pages from PAGE_ALIGN(chunk)

   echo 0 0 2 > /sys/kernel/debug/shrinker/pkvm*/scan
   ## Reclaim 2 pages ... from PAGE_ALIGN(chunk) again

Bug: 278749606
Bug: 273748186
Bug: 330679537
Change-Id: I813ea6c4cc934864e70b9666acde4f1a24d25a1b
Signed-off-by: default avatarVincent Donnefort <vdonnefort@google.com>
parent b029dce0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment