Re: [Patch v4 03/18] KVM: x86/mmu: Track count of pages in KVM MMU page caches globally
From: David Matlack
Date: Thu Mar 09 2023 - 18:53:55 EST
On Mon, Mar 06, 2023 at 02:41:12PM -0800, Vipin Sharma wrote:
> Create a global counter for total number of pages available
> in MMU page caches across all VMs. Add mmu_shadow_page_cache
> pages to this counter.
I think I prefer counting the objects on-demand in mmu_shrink_count(),
instead of keeping track of the count. Keeping track of the count adds
complexity to the topup/alloc paths for the sole benefit of the
shrinker. I'd rather contain that complexity to the shrinker code unless
there is a compelling reason to optimize mmu_shrink_count().
IIRC we discussed this at one point. Was there a reason to take this
approach that I'm just forgetting?