summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2014-05-13 05:26:43 +0000
committeralc <alc@FreeBSD.org>2014-05-13 05:26:43 +0000
commitab793415d02166fdd7cfea2301a03a903362e3f9 (patch)
treedab764ecea6a82638dd6322d5852ffe2c8506358 /sys/vm/vm_pageout.c
parent498371bb43d94d13fdf5c8bb2c7014840ec696ab (diff)
downloadFreeBSD-src-ab793415d02166fdd7cfea2301a03a903362e3f9.zip
FreeBSD-src-ab793415d02166fdd7cfea2301a03a903362e3f9.tar.gz
MFC r265418
Prior to r254304, a separate function, vm_pageout_page_stats(), was used to periodically update the reference status of the active pages. This function was called, instead of vm_pageout_scan(), when memory was not scarce. The objective was to provide up to date reference status for active pages in case memory did become scarce and active pages needed to be deactivated. The active page queue scan performed by vm_pageout_page_stats() was virtually identical to that performed by vm_pageout_scan(), and so r254304 eliminated vm_pageout_page_stats(). Instead, vm_pageout_scan() is called with the parameter "pass" set to zero. The intention was that when pass is zero, vm_pageout_scan() would only scan the active queue. However, the variable page_shortage can still be greater than zero when memory is not scarce and vm_pageout_scan() is called with pass equal to zero. Consequently, the inactive queue may be scanned and dirty pages laundered even though that was not intended by r254304. This revision fixes that.
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index d2ccfa0..9ccb606 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -942,13 +942,15 @@ vm_pageout_scan(struct vm_domain *vmd, int pass)
*/
addl_page_shortage = 0;
- deficit = atomic_readandclear_int(&vm_pageout_deficit);
-
/*
* Calculate the number of pages we want to either free or move
* to the cache.
*/
- page_shortage = vm_paging_target() + deficit;
+ if (pass > 0) {
+ deficit = atomic_readandclear_int(&vm_pageout_deficit);
+ page_shortage = vm_paging_target() + deficit;
+ } else
+ page_shortage = deficit = 0;
/*
* maxlaunder limits the number of dirty pages we flush per scan.
OpenPOWER on IntegriCloud