From nobody Wed Oct 20 01:23:18 2021 X-Original-To: dev-commits-src-main@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 AB42D180FC19; Wed, 20 Oct 2021 01:23:20 +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 4HYtCp4pvgz3lbH; Wed, 20 Oct 2021 01:23:18 +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 79B751EA31; Wed, 20 Oct 2021 01:23:18 +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 19K1NI71095518; Wed, 20 Oct 2021 01:23:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19K1NIGI095517; Wed, 20 Oct 2021 01:23:18 GMT (envelope-from git) Date: Wed, 20 Oct 2021 01:23:18 GMT Message-Id: <202110200123.19K1NIGI095517@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 92db9f3bb762 - main - Introduce vm_page_alloc_noobj_contig() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92db9f3bb7623883231214e74ec38788c3dffc6a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=92db9f3bb7623883231214e74ec38788c3dffc6a commit 92db9f3bb7623883231214e74ec38788c3dffc6a Author: Mark Johnston AuthorDate: 2021-10-20 00:24:21 +0000 Commit: Mark Johnston CommitDate: 2021-10-20 01:22:56 +0000 Introduce vm_page_alloc_noobj_contig() This is the same as vm_page_alloc_noobj(), but allocates physically contiguous runs of memory. For now it is implemented in terms of vm_page_alloc_contig(), with the difference that vm_page_alloc_noobj_contig() implements VM_ALLOC_ZERO by zeroing the page. Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32005 --- sys/vm/vm_page.c | 43 +++++++++++++++++++++++++++++++++++++++++++ sys/vm/vm_page.h | 6 ++++++ 2 files changed, 49 insertions(+) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 0190f67dd7da..6927d7af4409 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2509,6 +2509,49 @@ vm_page_alloc_noobj_domain(int domain, int req) return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); } +vm_page_t +vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + struct vm_domainset_iter di; + vm_page_t m; + int domain; + + vm_domainset_iter_page_init(&di, NULL, 0, &domain, &req); + do { + m = vm_page_alloc_noobj_contig_domain(domain, req, npages, low, + high, alignment, boundary, memattr); + if (m != NULL) + break; + } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); + + return (m); +} + +vm_page_t +vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr) +{ + vm_page_t m; + u_long i; + + KASSERT((req & (VM_ALLOC_SBUSY | VM_ALLOC_IGN_SBUSY | + VM_ALLOC_NOOBJ)) == 0, + ("%s: invalid req %#x", __func__, req)); + + m = vm_page_alloc_contig_domain(NULL, 0, domain, req | VM_ALLOC_NOOBJ, + npages, low, high, alignment, boundary, memattr); + if (m != NULL && (req & VM_ALLOC_ZERO) != 0) { + for (i = 0; i < npages; i++) { + if ((m[i].flags & PG_ZERO) == 0) + pmap_zero_page(&m[i]); + } + } + return (m); +} + /* * Check a page that has been freshly dequeued from a freelist. */ diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 600619b00eaf..b31ea0241cc7 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -616,6 +616,12 @@ vm_page_t vm_page_alloc_freelist(int, int); vm_page_t vm_page_alloc_freelist_domain(int, int, int); vm_page_t vm_page_alloc_noobj(int); vm_page_t vm_page_alloc_noobj_domain(int, int); +vm_page_t vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); +vm_page_t vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, + vm_memattr_t memattr); void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int);