vm_page: pass page to iter_free

Pass the to-be-freed page to vm_page_iter_free as a parameter, rather
than computing it from the iterator parameter, to improve performance.

Sort declarations of page_iter functions in vm_page.h.

Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D47727
This commit is contained in:
Doug Moore 2024-11-25 02:03:34 -06:00
parent 8ea6c11540
commit ff4c19bb54
4 changed files with 9 additions and 11 deletions

View File

@ -660,7 +660,7 @@ _kmem_unback(vm_object_t object, vm_offset_t addr, vm_size_t size)
m = vm_page_iter_lookup(&pages, atop(offset))) {
vm_page_xbusy_claim(m);
vm_page_unwire_noq(m);
vm_page_iter_free(&pages);
vm_page_iter_free(&pages, m);
}
VM_OBJECT_WUNLOCK(object);

View File

@ -2060,7 +2060,7 @@ wired:
if ((options & OBJPR_NOTMAPPED) == 0 &&
object->ref_count != 0 && !vm_page_try_remove_all(p))
goto wired;
vm_page_iter_free(&pages);
vm_page_iter_free(&pages, p);
}
vm_object_pip_wakeup(object);

View File

@ -1713,14 +1713,12 @@ vm_page_free_object_prep(vm_page_t m)
/*
* vm_page_iter_free:
*
* Free the current page, as identified by iterator.
* Free the given page, and use the iterator to remove it from the radix
* tree.
*/
void
vm_page_iter_free(struct pctrie_iter *pages)
vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m)
{
vm_page_t m;
m = vm_radix_iter_page(pages);
vm_radix_iter_remove(pages);
vm_page_free_object_prep(m);
vm_page_xunbusy(m);

View File

@ -602,7 +602,6 @@ bool vm_page_busy_sleep(vm_page_t m, const char *msg, int allocflags);
void vm_page_busy_sleep_unlocked(vm_object_t obj, vm_page_t m,
vm_pindex_t pindex, const char *wmesg, int allocflags);
void vm_page_free(vm_page_t m);
void vm_page_iter_free(struct pctrie_iter *);
void vm_page_free_zero(vm_page_t m);
void vm_page_activate (vm_page_t);
@ -651,11 +650,13 @@ void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags);
void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind, int pool);
int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);
void vm_page_invalid(vm_page_t m);
void vm_page_launder(vm_page_t m);
vm_page_t vm_page_lookup(vm_object_t, vm_pindex_t);
void vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m);
void vm_page_iter_init(struct pctrie_iter *, vm_object_t);
void vm_page_iter_limit_init(struct pctrie_iter *, vm_object_t, vm_pindex_t);
vm_page_t vm_page_iter_lookup(struct pctrie_iter *, vm_pindex_t);
bool vm_page_iter_remove(struct pctrie_iter *pages);
void vm_page_launder(vm_page_t m);
vm_page_t vm_page_lookup(vm_object_t, vm_pindex_t);
vm_page_t vm_page_lookup_unlocked(vm_object_t, vm_pindex_t);
vm_page_t vm_page_next(vm_page_t m);
void vm_page_pqbatch_drain(void);
@ -680,7 +681,6 @@ void vm_page_release(vm_page_t m, int flags);
void vm_page_release_locked(vm_page_t m, int flags);
vm_page_t vm_page_relookup(vm_object_t, vm_pindex_t);
bool vm_page_remove(vm_page_t);
bool vm_page_iter_remove(struct pctrie_iter *);
bool vm_page_remove_xbusy(vm_page_t);
int vm_page_rename(struct pctrie_iter *, vm_object_t, vm_pindex_t);
void vm_page_replace(vm_page_t mnew, vm_object_t object,