git: f2a193a967e3 - main - vm_pageout: reduce number of flush() params
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 30 May 2025 21:09:21 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=f2a193a967e3457e9fb5acb918106a71853b4249 commit f2a193a967e3457e9fb5acb918106a71853b4249 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2025-05-30 21:07:39 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2025-05-30 21:07:39 +0000 vm_pageout: reduce number of flush() params vm_pageout_flush is called in two places, and in both, the mreq parameter is 0. Drop that parameter, and simplify the calculations that use it. The prunlen and eio parameters are either both NULL, or neither NULL. Drop the prunlen parameter and, when eio is NULL, return the runlen value instead of the numpagedout parameter, which the caller ignores. Change a param from boolean_t* to bool*. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D50568 --- sys/vm/vm_object.c | 8 ++++---- sys/vm/vm_pageout.c | 30 ++++++++++++++---------------- sys/vm/vm_pageout.h | 2 +- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 1d372ba04488..0e429b58aa1c 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -1000,7 +1000,7 @@ vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *allclean) static int vm_object_page_clean_flush(struct pctrie_iter *pages, vm_page_t p, - int pagerflags, int flags, boolean_t *allclean, boolean_t *eio) + int pagerflags, int flags, boolean_t *allclean, bool *eio) { vm_page_t ma[vm_pageout_page_count]; int count, runlen; @@ -1020,8 +1020,7 @@ vm_object_page_clean_flush(struct pctrie_iter *pages, vm_page_t p, } } - vm_pageout_flush(ma, count, pagerflags, 0, &runlen, eio); - return (runlen); + return (vm_pageout_flush(ma, count, pagerflags, eio)); } /* @@ -1054,7 +1053,8 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, vm_page_t np, p; vm_pindex_t pi, tend, tstart; int curgeneration, n, pagerflags; - boolean_t eio, res, allclean; + boolean_t res, allclean; + bool eio; VM_OBJECT_ASSERT_WLOCKED(object); diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 704f1046d727..624184d57442 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -438,7 +438,7 @@ vm_pageout_cluster(vm_page_t m) } return (vm_pageout_flush(&mc[page_base], pageout_count, - VM_PAGER_PUT_NOREUSE, 0, NULL, NULL)); + VM_PAGER_PUT_NOREUSE, NULL)); } /* @@ -450,19 +450,19 @@ vm_pageout_cluster(vm_page_t m) * the parent to do more sophisticated things we may have to change * the ordering. * - * Returned runlen is the count of pages between mreq and first - * page after mreq with status VM_PAGER_AGAIN. - * *eio is set to TRUE if pager returned VM_PAGER_ERROR or VM_PAGER_FAIL - * for any page in runlen set. + * If eio is not NULL, returns the count of pages between 0 and first page + * with status VM_PAGER_AGAIN. *eio is set to true if pager returned + * VM_PAGER_ERROR or VM_PAGER_FAIL for any page in that set. + * + * Otherwise, returns the number of paged-out pages. */ int -vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, - boolean_t *eio) +vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio) { vm_object_t object = mc[0]->object; int pageout_status[count]; int numpagedout = 0; - int i, runlen; + int i; VM_OBJECT_ASSERT_WLOCKED(object); @@ -488,9 +488,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, vm_pager_put_pages(object, mc, count, flags, pageout_status); - runlen = count - mreq; if (eio != NULL) - *eio = FALSE; + *eio = false; for (i = 0; i < count; i++) { vm_page_t mt = mc[i]; @@ -540,12 +539,11 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, numpagedout++; } else vm_page_activate(mt); - if (eio != NULL && i >= mreq && i - mreq < runlen) - *eio = TRUE; + if (eio != NULL) + *eio = true; break; case VM_PAGER_AGAIN: - if (i >= mreq && i - mreq < runlen) - runlen = i - mreq; + count = i; break; } @@ -560,8 +558,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen, vm_page_sunbusy(mt); } } - if (prunlen != NULL) - *prunlen = runlen; + if (eio != NULL) + return (count); return (numpagedout); } diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h index a6cdfafe743b..5cfb6e5ca198 100644 --- a/sys/vm/vm_pageout.h +++ b/sys/vm/vm_pageout.h @@ -100,7 +100,7 @@ void vm_wait_domain(int domain); void vm_wait_min(void); void vm_wait_severe(void); -int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *); +int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio); void vm_pageout_oom(int shortage); #endif /* _KERNEL */