git: 4c57d6d55516 - main - amd64/pmap: fix user page table page accounting
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 01:15:33 UTC
The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=4c57d6d5551629df348e2087d2382ae7cbf8b312 commit 4c57d6d5551629df348e2087d2382ae7cbf8b312 Author: Alan Cox <alc@FreeBSD.org> AuthorDate: 2021-12-05 23:40:53 +0000 Commit: Alan Cox <alc@FreeBSD.org> CommitDate: 2021-12-06 01:13:43 +0000 amd64/pmap: fix user page table page accounting When a superpage mapping is destroyed and the original page table page containing 4KB mappings that was being held in reserve is deallocated, the recently introduced user page table page count was not being decremented. Consequentially, the count was wrong and would grow over time. For example, after multiple iterations of "buildworld", I was seeing implausible counts, like the following: vm.pmap.kernel_pt_page_count: 2184 vm.pmap.user_pt_page_count: 2280849 vm.pmap.pv_page_count: 106 With this change, I now see: vm.pmap.kernel_pt_page_count: 2183 vm.pmap.user_pt_page_count: 344 vm.pmap.pv_page_count: 105 Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D33276 --- sys/amd64/amd64/pmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index e9973a420de3..153664698e43 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -6140,7 +6140,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pde: pte page not promoted")); - pmap_resident_count_adj(pmap, -1); + pmap_pt_page_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pde: pte page ref count error")); mpte->ref_count = 0; @@ -8408,7 +8408,7 @@ pmap_remove_pages(pmap_t pmap) if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pages: pte page not promoted")); - pmap_resident_count_adj(pmap, -1); + pmap_pt_page_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pages: pte page reference count error")); mpte->ref_count = 0;