Skip to content

Commit

Permalink
vm: Retire vm_page_alloc_freelist{,_domain}()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alcriceedu committed Jul 24, 2024
1 parent cd836f6 commit 096dfa3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 74 deletions.
4 changes: 4 additions & 0 deletions ObsoleteFiles.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions share/man/man9/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
26 changes: 1 addition & 25 deletions share/man/man9/vm_page_alloc.9
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
51 changes: 6 additions & 45 deletions sys/vm/vm_page.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions sys/vm/vm_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 096dfa3

Please sign in to comment.