[PATCH v3 04/17] KVM: arm64: Add a heap allocator for the pKVM hyp
Vincent Donnefort
vdonnefort at google.com
Thu Jul 23 08:11:20 PDT 2026
On Thu, Jul 23, 2026 at 02:19:00PM +0100, Fuad Tabba wrote:
> Hi Vincent,
>
> On Mon, 20 Jul 2026 at 18:15, Vincent Donnefort <vdonnefort at google.com> wrote:
>
> > +static unsigned long hyp_allocator_reclaimable(struct hyp_allocator *allocator)
> > +{
> > + unsigned long reclaimable = 0;
> > + struct chunk_hdr *chunk;
> > +
> > + guard(hyp_spinlock)(&allocator->lock);
> > +
> > + chunk = allocator->head;
> > + while (chunk) {
> > + reclaimable += hyp_allocator_chunk_reclaimable(allocator, chunk, NULL, NULL);
> > + chunk = chunk_get_next(chunk);
> > + }
>
> Sashiko raised this, again, confusingly in a different patch.
> hyp_allocator_reclaimable() counts only the per-chunk reclaimable
> pages, but hyp_allocator_reclaim() drains allocator->mc first, so the
> memcache pages are reclaimable yet not counted here. When mc holds the
> only free pages and there are no reclaimable chunks, this returns 0,
> pkvm_shrinker_count() reports SHRINK_EMPTY, and scan() is never called
> to free them. Should you add allocator->mc.nr_pages to the total?
Yes of course, this should be added. We actually have it in the Android version.
>
> Cheers,
> /fuad
More information about the linux-arm-kernel
mailing list