From nobody Tue Jul 30 15:38:49 2024 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 4WYKBx51j4z5RRPJ; Tue, 30 Jul 2024 15:38:49 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WYKBx2dmKz42Gg; Tue, 30 Jul 2024 15:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722353929; 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=w8CkQ0esVl/7SuauL2cAY9snG1D2mAoMOA8hx2YCnqo=; b=Xq/LckylCp5w/M3DLCIjNPpvmfAvJ88CiZov3/hXy2OG1lldUMcJVUzUQAtOsBYHcyqIH2 o/vcpNGecjFXnVj4igquln7X5ud36DSvEvDwGCqV9a5rjfpy3pYDWbqidV4y2TmLUoym7N 6LgS6h629WMMeDK2WsRzSVvCORM/6CUxYXu4gHtgHkspw7tdtF6Zl3Bf9egcVtQusnZ4NJ gJxmSXneNFxz5AjtRYdqYPiv+2Qz/DAnbObYzNTzlFFdP5N3IosnQTyEg5ecsOu26Hjo/M Iy6kGP6LU260bPHAj2aj8MtVp2ikSo55Q2ocg3IiNpzI2H7pv9txbg+pFWiXAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722353929; a=rsa-sha256; cv=none; b=j0lPKjITnTIagm47rJHlE/K/u2uaooWglxHij69Chsbjj2lE6lKHBxNr3mfNjBxblgcmWR amWJe3zPFTxoeFPRPSz8uymyzbWwIPqpoBCJNYwN5p24sxDDs9TgUb7CeLOcoypnd26RgP /PTGiB6lyzhO06BH2FvOb0pmv+Q5sy7Aq9cMTlEhExorsiDtHaObs5cYTNiDUXqOOcVKsK LzlapvBFMvOAjcXm1LQc5dwr/I3mPpaLSDnrZhVefjZBsyFFEmLvBtSn5b6FRen6IOAO9h Z+oRMkaiW9qCyA+N6oGdHdUcPyGhneZdASDem852JNQ9f3ZrZm6lvoL6doCEOg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722353929; 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=w8CkQ0esVl/7SuauL2cAY9snG1D2mAoMOA8hx2YCnqo=; b=U06Ofm4Kb/A2k+TTkOqGqZclq3TvWsaQrhngTc7nJdlRGqJj2YXGeN9SuBOMx3Au0L2nfs a29GkhLew+bxG0lF+WmcPZfNPi9LIcgJyH2/lGsG92DJoMg37YKdg2t4SVwYFrNl3nkMTP M4u4+XS1o3IoKhzWbbbMfivXOhYqymKkUlXmkG3iWV9rznJepTdkFMHE2KRfIKQlI6KkVd syu+oaFCRUv6kfoZrng4b0mf9kyfGsNhgUu8SMKQ3p/EJfFLnX6EBjwnysISBn85LHO8iY LbI/N5Vn5kYIHrfqii3RyH36GNJcWcwtiqxE1TSTeu5PaoaNdeZL7kAxJLQeyg== 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 4WYKBx2FRrzNKl; Tue, 30 Jul 2024 15:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46UFcnai049701; Tue, 30 Jul 2024 15:38:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46UFcnNn049698; Tue, 30 Jul 2024 15:38:49 GMT (envelope-from git) Date: Tue, 30 Jul 2024 15:38:49 GMT Message-Id: <202407301538.46UFcnNn049698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: ddc09a10eaa6 - main - pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pages 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ddc09a10eaa66bbebeb691021bb2a9f934d33d58 Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=ddc09a10eaa66bbebeb691021bb2a9f934d33d58 commit ddc09a10eaa66bbebeb691021bb2a9f934d33d58 Author: Bojan Novković AuthorDate: 2024-07-16 15:12:25 +0000 Commit: Bojan Novković CommitDate: 2024-07-30 15:38:24 +0000 pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pages This patch modifies pmap_growkernel in all pmaps to use VM_ALLOC_NOFREE when allocating new pagetable pages. This should help reduce longterm fragmentation as these pages are never released after they are allocated. Differential Revision: https://reviews.freebsd.org/D45998 Reviewed by: alc, markj, kib, mhorne Tested by: alc --- sys/amd64/amd64/pmap.c | 7 ++++--- sys/arm/arm/pmap-v6.c | 2 +- sys/arm64/arm64/pmap.c | 6 +++--- sys/i386/i386/pmap.c | 4 ++-- sys/powerpc/aim/mmu_radix.c | 6 +++--- sys/riscv/riscv/pmap.c | 6 +++--- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 778d07689ff0..cf0fc7184f56 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -5156,8 +5156,8 @@ pmap_growkernel(vm_offset_t addr) pdpe = pmap_pdpe(kernel_pmap, end); if ((*pdpe & X86_PG_V) == 0) { nkpg = pmap_alloc_pt_page(kernel_pmap, - pmap_pdpe_pindex(end), VM_ALLOC_WIRED | - VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); + pmap_pdpe_pindex(end), VM_ALLOC_INTERRUPT | + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); paddr = VM_PAGE_TO_PHYS(nkpg); @@ -5176,7 +5176,8 @@ pmap_growkernel(vm_offset_t addr) } nkpg = pmap_alloc_pt_page(kernel_pmap, pmap_pde_pindex(end), - VM_ALLOC_WIRED | VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); + VM_ALLOC_INTERRUPT | VM_ALLOC_NOFREE | VM_ALLOC_WIRED | + VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); paddr = VM_PAGE_TO_PHYS(nkpg); diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index de1082e7ae62..6cc78b187a9a 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -2067,7 +2067,7 @@ pmap_growkernel(vm_offset_t addr) * Install new PT2s page into kernel PT2TAB. */ m = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (m == NULL) panic("%s: no memory to grow kernel", __func__); m->pindex = pte1_index(kernel_vm_end) & ~PT2PG_MASK; diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 59de6ef37f09..58795e25c82e 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -2959,7 +2959,7 @@ pmap_growkernel(vm_offset_t addr) if (pmap_load(l1) == 0) { /* We need a new PDP entry */ nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> L1_SHIFT; @@ -2978,8 +2978,8 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> L2_SHIFT; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 5808c31a99af..57ba48d399c3 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -2264,8 +2264,8 @@ __CONCAT(PMTYPE, growkernel)(vm_offset_t addr) continue; } - nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> PDRSHIFT; diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index ae6e4d116e87..0a38ad97ad91 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -3580,7 +3580,7 @@ mmu_radix_growkernel(vm_offset_t addr) if ((be64toh(*l2e) & PG_V) == 0) { /* We need a new PDP entry */ nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> L2_PAGE_SIZE_SHIFT; @@ -3598,8 +3598,8 @@ mmu_radix_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = pmap_l3e_pindex(kernel_vm_end); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index bcf2ada887fb..34922b0f511e 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1832,7 +1832,7 @@ pmap_growkernel(vm_offset_t addr) if (pmap_load(l1) == 0) { /* We need a new PDP entry */ nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> L1_SHIFT; @@ -1857,8 +1857,8 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = vm_page_alloc_noobj(VM_ALLOC_INTERRUPT | + VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); nkpg->pindex = kernel_vm_end >> L2_SHIFT;