git: b3cec803eaa4 - main - vm_fault: avoid vm_page_next()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 27 Jul 2024 21:14:53 UTC
The branch main has been updated by dougm:
URL: https://cgit.FreeBSD.org/src/commit/?id=b3cec803eaa4ae3495f9844f93c1f0cadc1b2d6a
commit b3cec803eaa4ae3495f9844f93c1f0cadc1b2d6a
Author: Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-07-27 21:11:53 +0000
Commit: Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-07-27 21:11:53 +0000
vm_fault: avoid vm_page_next()
Where vm_fault calls vm_page_next, replace it with a use of TAILQ_NEXT
and a KASSERT. This avoids needless computation in a NODEBUG kernel
and makes the error checking clearer in a GENERIC kernel.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D46168
---
sys/vm/vm_fault.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index df686f3e46dc..6e0415b30600 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -485,7 +485,9 @@ vm_fault_populate_cleanup(vm_object_t object, vm_pindex_t first,
VM_OBJECT_ASSERT_WLOCKED(object);
MPASS(first <= last);
for (pidx = first, m = vm_page_lookup(object, pidx);
- pidx <= last; pidx++, m = vm_page_next(m)) {
+ pidx <= last; pidx++, m = TAILQ_NEXT(m, listq)) {
+ KASSERT(m != NULL && m->pindex == pidx,
+ ("%s: pindex mismatch", __func__));
vm_fault_populate_check_page(m);
vm_page_deactivate(m);
vm_page_xunbusy(m);
@@ -623,9 +625,10 @@ vm_fault_populate(struct faultstate *fs)
}
for (pidx = pager_first, m = vm_page_lookup(fs->first_object, pidx);
pidx <= pager_last;
- pidx += npages, m = vm_page_next(&m[npages - 1])) {
+ pidx += npages, m = TAILQ_NEXT(&m[npages - 1], listq)) {
vaddr = fs->entry->start + IDX_TO_OFF(pidx) - fs->entry->offset;
-
+ KASSERT(m != NULL && m->pindex == pidx,
+ ("%s: pindex mismatch", __func__));
psind = m->psind;
while (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 ||
pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last ||