diff options
author | rstone <rstone@FreeBSD.org> | 2015-08-20 20:28:51 +0000 |
---|---|---|
committer | rstone <rstone@FreeBSD.org> | 2015-08-20 20:28:51 +0000 |
commit | fe0a547dd0529b8fe1f9bfa1f450bfe1206b688f (patch) | |
tree | cf34ab1f7922e3320bcbde492b01792883d543a4 | |
parent | 24688715b7291c131aa277bfabca1914e583577e (diff) | |
download | FreeBSD-src-fe0a547dd0529b8fe1f9bfa1f450bfe1206b688f.zip FreeBSD-src-fe0a547dd0529b8fe1f9bfa1f450bfe1206b688f.tar.gz |
Prevent ticks rollover from preventing vm_lowmem event
Currently vm_pageout_scan() uses a ticks-based scheme to rate-limit
the number of times that the vm_lowmem event will happen. However
if no events happen for long enough for ticks to roll over, this
leaves us in a long window in which vm_lowmem events will not
happen.
Replace the use of ticks with time_t to prevent rollover from ever
being an issue.
Reviewed by: ian
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3439
-rw-r--r-- | sys/vm/vm_pageout.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 13916c0..07f5444 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sdt.h> #include <sys/signalvar.h> #include <sys/smp.h> +#include <sys/time.h> #include <sys/vnode.h> #include <sys/vmmeter.h> #include <sys/rwlock.h> @@ -171,7 +172,7 @@ static int vm_pageout_update_period; static int defer_swap_pageouts; static int disable_swap_pageouts; static int lowmem_period = 10; -static int lowmem_ticks; +static time_t lowmem_uptime; #if defined(NO_SWAPPING) static int vm_swap_enabled = 0; @@ -1034,7 +1035,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) * some. We rate limit to avoid thrashing. */ if (vmd == &vm_dom[0] && pass > 0 && - (ticks - lowmem_ticks) / hz >= lowmem_period) { + (time_uptime - lowmem_uptime) >= lowmem_period) { /* * Decrease registered cache sizes. */ @@ -1045,7 +1046,7 @@ vm_pageout_scan(struct vm_domain *vmd, int pass) * drained above. */ uma_reclaim(); - lowmem_ticks = ticks; + lowmem_uptime = time_uptime; } /* |