git: 6d42d5dbdd67 - main - vm_glue: use vm_page_alloc_domain_after
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 19 Oct 2024 20:24:52 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=6d42d5dbdd677c3422bdb3867770639f48c6df7a commit 6d42d5dbdd677c3422bdb3867770639f48c6df7a Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-10-19 20:22:20 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-10-19 20:22:20 +0000 vm_glue: use vm_page_alloc_domain_after Drop the function vm_page_alloc_domain, used only in vm_thread_stack_back, and replace it with vm_page_alloc_domain_after there, with the extra mpred argument either computed on the first iteration or retrieved from previous iterations. Define a function vm_page_mpred() for computing that first mpred argument. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D47054 --- sys/vm/vm_glue.c | 5 +++-- sys/vm/vm_page.c | 27 +++++++++++++++------------ sys/vm/vm_page.h | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 5128c46a1d9f..0090904785ab 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -623,8 +623,9 @@ vm_thread_stack_back(vm_offset_t ks, vm_page_t ma[], int npages, int req_class, m = vm_page_grab(obj, pindex + n, VM_ALLOC_NOCREAT | VM_ALLOC_WIRED); if (m == NULL) { - m = vm_page_alloc_domain(obj, pindex + n, domain, - req_class | VM_ALLOC_WIRED); + m = n > 0 ? ma[n - 1] : vm_page_mpred(obj, pindex); + m = vm_page_alloc_domain_after(obj, pindex + n, domain, + req_class | VM_ALLOC_WIRED, m); } if (m == NULL) break; diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index f2b3baf419a0..054832e3f19a 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2013,6 +2013,18 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex) return (0); } +/* + * vm_page_mpred: + * + * Return the greatest page of the object with index <= pindex, + * or NULL, if there is none. Assumes object lock is held. + */ +vm_page_t +vm_page_mpred(vm_object_t object, vm_pindex_t pindex) +{ + return (vm_radix_lookup_le(&object->rtree, pindex)); +} + /* * vm_page_alloc: * @@ -2040,16 +2052,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req) { return (vm_page_alloc_after(object, pindex, req, - vm_radix_lookup_le(&object->rtree, pindex))); -} - -vm_page_t -vm_page_alloc_domain(vm_object_t object, vm_pindex_t pindex, int domain, - int req) -{ - - return (vm_page_alloc_domain_after(object, pindex, domain, req, - vm_radix_lookup_le(&object->rtree, pindex))); + vm_page_mpred(object, pindex))); } /* @@ -2390,7 +2393,7 @@ vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, object)); KASSERT(npages > 0, ("vm_page_alloc_contig: npages is zero")); - mpred = vm_radix_lookup_le(&object->rtree, pindex); + mpred = vm_page_mpred(object, pindex); KASSERT(mpred == NULL || mpred->pindex != pindex, ("vm_page_alloc_contig: pindex already allocated")); for (;;) { @@ -5073,7 +5076,7 @@ vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, pflags = vm_page_grab_pflags(allocflags); i = 0; retrylookup: - m = vm_radix_lookup_le(&object->rtree, pindex + i); + m = vm_page_mpred(object, pindex + i); if (m == NULL || m->pindex != pindex + i) { mpred = m; m = NULL; diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index c7c1ec3872a8..b85342b784de 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -606,8 +606,8 @@ void vm_page_free_zero(vm_page_t m); void vm_page_activate (vm_page_t); void vm_page_advise(vm_page_t m, int advice); +vm_page_t vm_page_mpred(vm_object_t, vm_pindex_t); vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); -vm_page_t vm_page_alloc_domain(vm_object_t, vm_pindex_t, int, int); vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); vm_page_t vm_page_alloc_domain_after(vm_object_t, vm_pindex_t, int, int, vm_page_t);