8000 vm_pageout: reduce number of flush() params · freebsd/freebsd-src@f2a193a · GitHub
[go: up one dir, main page]

Skip to content

Commit f2a193a

Browse files
Doug MooreDoug Moore
authored andcommitted
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
1 parent 6ac71c4 commit f2a193a

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

sys/vm/vm_object.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ vm_object_page_remove_write(vm_page_t p, int flags, boolean_t *allclean)
10001000

10011001
static int
10021002
vm_object_page_clean_flush(struct pctrie_iter *pages, vm_page_t p,
1003-
int pagerflags, int flags, boolean_t *allclean, boolean_t *eio)
1003+
int pagerflags, int flags, boolean_t *allclean, bool *eio)
10041004
{
10051005
vm_page_t ma[vm_pageout_page_count];
10061006
int count, runlen;
@@ -1020,8 +1020,7 @@ vm_object_page_clean_flush(struct pctrie_iter *pages, vm_page_t p,
10201020
}
10211021
}
10221022

1023-
vm_pageout_flush(ma, count, pagerflags, 0, &runlen, eio);
1024-
return (runlen);
1023+
return (vm_pageout_flush(ma, count, pagerflags, eio));
10251024
}
10261025

10271026
/*
@@ -1054,7 +1053,8 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end,
10541053
vm_page_t np, p;
10551054
vm_pindex_t pi, tend, tstart;
10561055
int curgeneration, n, pagerflags;
1057-
boolean_t eio, res, allclean;
1056+
boolean_t res, allclean;
1057+
bool eio;
10581058

10591059
VM_OBJECT_ASSERT_WLOCKED(object);
10601060

sys/vm/vm_pageout.c

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ vm_pageout_cluster(vm_page_t m)
438438
}
439439

440440
return (vm_pageout_flush(&mc[page_base], pageout_count,
441-
VM_PAGER_PUT_NOREUSE, 0, NULL, NULL));
441+
VM_PAGER_PUT_NOREUSE, NULL));
442442
}
443443

444444
/*
@@ -450,19 +450,19 @@ vm_pageout_cluster(vm_page_t m)
450450
* the parent to do more sophisticated things we may have to change
451451
* the ordering.
452452
*
453-
* Returned runlen is the count of pages between mreq and first
454-
* page after mreq with status VM_PAGER_AGAIN.
455-
* *eio is set to TRUE if pager returned VM_PAGER_ERROR or VM_PAGER_FAIL
456-
* for any page in runlen set.
453+
* If eio is not NULL, returns the count of pages between 0 and first page
454+
* with status VM_PAGER_AGAIN. *eio is set to true if pager returned
455+
* VM_PAGER_ERROR or VM_PAGER_FAIL for any page in that set.
456+
*
457+
* Otherwise, returns the number of paged-out pages.
457458
*/
458459
int
459-
vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen,
460-
boolean_t *eio)
460+
vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio)
461461
{
462462
vm_object_t object = mc[0]->object;
463463
int pageout_status[count];
464464
int numpagedout = 0;
465-
int i, runlen;
465+
int i;
466466

467467
VM_OBJECT_ASSERT_WLOCKED(object);
468468

@@ -488,9 +488,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen,
488488

489489
vm_pager_put_pages(object, mc, count, flags, pageout_status);
490490

491-
runlen = count - mreq;
492491
if (eio != NULL)
493-
*eio = FALSE;
492+
*eio = false;
494493
for (i = 0; i < count; i++) {
495494
vm_page_t mt = mc[i];
496495

@@ -540,12 +539,11 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen,
540539
numpagedout++;
541540
} else
542541
vm_page_activate(mt);
543-
if (eio != NULL && i >= mreq && i - mreq < runlen)
544-
*eio = TRUE;
542+
if (eio != NULL)
543+
*eio = true;
545544
break;
546545
case VM_PAGER_AGAIN:
547-
if (i >= mreq && i - mreq < runlen)
548-
runlen = i - mreq;
546+
count = i;
549547
break;
550548
}
551549

@@ -560,8 +558,8 @@ vm_pageout_flush(vm_page_t *mc, int count, int flags, int mreq, int *prunlen,
560558
vm_page_sunbusy(mt);
561559
}
562560
}
563-
if (prunlen != NULL)
564-
*prunlen = runlen;
561+
if (eio != NULL)
562+
return (count);
565563
return (numpagedout);
566564
}
567565

sys/vm/vm_pageout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void vm_wait_domain(int domain);
100100
void vm_wait_min(void);
101101
void vm_wait_severe(void);
102102

103-
int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
103+
int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio);
104104
void vm_pageout_oom(int shortage);
105105

106106
#endif /* _KERNEL */

0 commit comments

Comments
 (0)
0