From nobody Mon Dec 6 01:15:33 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 8BE3518CACEE; Mon, 6 Dec 2021 01:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J6lqB1sLzz4lGB; Mon, 6 Dec 2021 01:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1178922808; Mon, 6 Dec 2021 01:15:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B61FXkv052975; Mon, 6 Dec 2021 01:15:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B61FX6v052974; Mon, 6 Dec 2021 01:15:33 GMT (envelope-from git) Date: Mon, 6 Dec 2021 01:15:33 GMT Message-Id: <202112060115.1B61FX6v052974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 4c57d6d55516 - main - amd64/pmap: fix user page table page accounting List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c57d6d5551629df348e2087d2382ae7cbf8b312 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638753334; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sTQVGo2+6cyY2RHjqAe2Ft5VuQDlbCpkhZk9tcrKf6s=; b=yRgBmzrDrT4Y5JT1m8EVhBlTE8rTTcnQuPuskkCAVpJ2+RP4DMCiYihiqn0gFwmCcEPavv wvhWPRkHj1LkGRMsCvLEOR9YFcYEwwZUDlaS160YXU8iV7EqeKAbQXVVVdFaa4WVPjWQxr /v/y5DXsLzeCT+NKrM8FDRamUcdvubllJunDBMHwNU6ZGwquO5LZUo++W1dT9VNRa8nGGO KUxmCBBNMPRICCIoTUFp3lWI7eB5fhjSqIPoc8wvf5cZAYUSR1KBCbjU0T3/1cfTcaNAC2 gatm0Ogr0IFHKd4CYOTRQl+k9CmDNqaWNqNyhodbn4LYlx4P0dfpKf/nppUBJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638753334; a=rsa-sha256; cv=none; b=Xc6PXXsLxEGMHv1riq3Jw1qMr8A66seO8N77+yj8BWZpb7ntQx2ZUCDqDjt8nBna9GRMmn zJl9GVnardwGzeGNQp6mWq1Vjm2cnPJiLVXSsxByZzI5IyUzinxIwRUUpPbLE3CxyZcZvN in37VIcxmQxqh9/p97esqolcgVbu9IA2Puk/7lrSHQXHZaTqlCcVz2Tm6kbFS3+ZADGuDl L4zGaKRJZveF2LmGvU1Km3YXwOJsweOdmruN0wjU1CcS9LbozUjiyyGL91dqbRzbsTyulT rNg8dVoiKNDIrXjOLk+5HqGKOxAt26nelo7l45VvkuGKygQUqa1CyAUp41oZCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=4c57d6d5551629df348e2087d2382ae7cbf8b312 commit 4c57d6d5551629df348e2087d2382ae7cbf8b312 Author: Alan Cox AuthorDate: 2021-12-05 23:40:53 +0000 Commit: Alan Cox 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;