From 096dfa338d7391cc957dba9cca44ceb7f78cb891 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Tue, 23 Jul 2024 02:14:31 -0500 Subject: [PATCH] vm: Retire vm_page_alloc_freelist{,_domain}() Once upon a time, I created vm_page_alloc_freelist{,_domain}() to support faster allocation of pages that were mapped by the partial direct map on 32-bit MIPS. At the time, I expected that these functions might find other uses too, but those other uses never materialized. So, these functions have not been used for some time now. Instead, people use the more general vm_page_alloc_contig(). Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D46063 --- ObsoleteFiles.inc | 4 +++ share/man/man9/Makefile | 2 -- share/man/man9/vm_page_alloc.9 | 26 +---------------- sys/vm/vm_page.c | 51 ++++------------------------------ sys/vm/vm_page.h | 2 -- 5 files changed, 11 insertions(+), 74 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f8f0309d6ccf3f..02a34a2541ebd1 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20240721: retire vm_page_alloc_freelist +OLD_FILES+=usr/share/man/man9/vm_page_alloc_freelist.9.gz +OLD_FILES+=usr/share/man/man9/vm_page_alloc_freelist_domain.9.gz + # 20240716: retire mergemaster OLD_FILES+=usr/sbin/mergemaster OLD_FILES+=usr/share/man/man8/mergemaster.8.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 9880b7b2f5e401..f7c21ab541b668 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -2384,8 +2384,6 @@ MLINKS+=vm_page_alloc.9 vm_page_alloc_after.9 \ vm_page_alloc.9 vm_page_alloc_contig_domain.9 \ vm_page_alloc.9 vm_page_alloc_domain.9 \ vm_page_alloc.9 vm_page_alloc_domain_after.9 \ - vm_page_alloc.9 vm_page_alloc_freelist.9 \ - vm_page_alloc.9 vm_page_alloc_freelist_domain.9 \ vm_page_alloc.9 vm_page_alloc_noobj.9 \ vm_page_alloc.9 vm_page_alloc_noobj_contig.9 \ vm_page_alloc.9 vm_page_alloc_noobj_contig_domain.9 \ diff --git a/share/man/man9/vm_page_alloc.9 b/share/man/man9/vm_page_alloc.9 index de225e05d7076d..7d6cf1692bb104 100644 --- a/share/man/man9/vm_page_alloc.9 +++ b/share/man/man9/vm_page_alloc.9 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH .\" DAMAGE. .\" -.Dd November 11, 2021 +.Dd July 21, 2024 .Dt VM_PAGE_ALLOC 9 .Os .Sh NAME @@ -87,17 +87,6 @@ .Fa "vm_page_t mpred" .Fc .Ft vm_page_t -.Fo vm_page_alloc_freelist -.Fa "int freelist" -.Fa "int req" -.Fc -.Ft vm_page_t -.Fo vm_page_alloc_freelist_domain -.Fa "int domain" -.Fa "int freelist" -.Fa "int req" -.Fc -.Ft vm_page_t .Fo vm_page_alloc_noobj .Fa "int req" .Fc @@ -212,19 +201,6 @@ or will carry the machine-dependent encoding of the memory attribute. Additionally, the direct mapping of the page, if any, will be updated to reflect the requested memory attribute. -.Pp -The -.Fn vm_page_alloc_freelist -and -.Fn vm_page_alloc_freelist_domain -functions behave identically to -.Fn vm_page_alloc_noobj -and -.Fn vm_page_alloc_noobj_domain , -respectively, except that a successful allocation will return a page from the -specified physical memory freelist. -These functions are not intended for use outside of the virtual memory -subsystem and exist only to support the requirements of certain platforms. .Sh REQUEST FLAGS All page allocator functions accept a .Fa req diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index c9ac793306968c..64413ba10bfabb 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2406,11 +2406,10 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, /* * Allocate a physical page that is not intended to be inserted into a VM - * object. If the "freelist" parameter is not equal to VM_NFREELIST, then only - * pages from the specified vm_phys freelist will be returned. + * object. */ -static __always_inline vm_page_t -_vm_page_alloc_noobj_domain(int domain, const int freelist, int req) +vm_page_t +vm_page_alloc_noobj_domain(int domain, int req) { struct vm_domain *vmd; vm_page_t m; @@ -2426,8 +2425,7 @@ _vm_page_alloc_noobj_domain(int domain, const int freelist, int req) flags = (req & VM_ALLOC_NODUMP) != 0 ? PG_NODUMP : 0; vmd = VM_DOMAIN(domain); again: - if (freelist == VM_NFREELIST && - vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) { + if (vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone != NULL) { m = uma_zalloc(vmd->vmd_pgcache[VM_FREEPOOL_DIRECT].zone, M_NOWAIT | M_NOVM); if (m != NULL) { @@ -2438,17 +2436,12 @@ _vm_page_alloc_noobj_domain(int domain, const int freelist, int req) if (vm_domain_allocate(vmd, req, 1)) { vm_domain_free_lock(vmd); - if (freelist == VM_NFREELIST) - m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DIRECT, 0); - else - m = vm_phys_alloc_freelist_pages(domain, freelist, - VM_FREEPOOL_DIRECT, 0); + m = vm_phys_alloc_pages(domain, VM_FREEPOOL_DIRECT, 0); vm_domain_free_unlock(vmd); if (m == NULL) { vm_domain_freecnt_inc(vmd, 1); #if VM_NRESERVLEVEL > 0 - if (freelist == VM_NFREELIST && - vm_reserv_reclaim_inactive(domain)) + if (vm_reserv_reclaim_inactive(domain)) goto again; #endif } @@ -2482,32 +2475,6 @@ _vm_page_alloc_noobj_domain(int domain, const int freelist, int req) return (m); } -vm_page_t -vm_page_alloc_freelist(int freelist, int req) -{ - 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_freelist_domain(domain, freelist, req); - if (m != NULL) - break; - } while (vm_domainset_iter_page(&di, NULL, &domain) == 0); - - return (m); -} - -vm_page_t -vm_page_alloc_freelist_domain(int domain, int freelist, int req) -{ - KASSERT(freelist >= 0 && freelist < VM_NFREELIST, - ("%s: invalid freelist %d", __func__, freelist)); - - return (_vm_page_alloc_noobj_domain(domain, freelist, req)); -} - vm_page_t vm_page_alloc_noobj(int req) { @@ -2525,12 +2492,6 @@ vm_page_alloc_noobj(int req) return (m); } -vm_page_t -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, diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 49f4c0fbc0cb08..61a0228273c2a7 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -614,8 +614,6 @@ vm_page_t vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, 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 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,