freebsd-skq/sys
Alan Cox ebcddc7217 Introduce a new page queue, PQ_LAUNDRY, for storing unreferenced, dirty
pages, specificially, dirty pages that have passed once through the inactive
queue.  A new, dedicated thread is responsible for both deciding when to
launder pages and actually laundering them.  The new policy uses the
relative sizes of the inactive and laundry queues to determine whether to
launder pages at a given point in time.  In general, this leads to more
intelligent swapping behavior, since the laundry thread will avoid pageouts
when the marginal benefit of doing so is low.  Previously, without a
dedicated queue for dirty pages, the page daemon didn't have the information
to determine whether pageout provides any benefit to the system.  Thus, the
previous policy often resulted in small but steadily increasing amounts of
swap usage when the system is under memory pressure, even when the inactive
queue consisted mostly of clean pages.  This change addresses that issue,
and also paves the way for some future virtual memory system improvements by
removing the last source of object-cached clean pages, i.e., PG_CACHE pages.

The new laundry thread sleeps while waiting for a request from the page
daemon thread(s).  A request is raised by setting the variable
vm_laundry_request and waking the laundry thread.  We request launderings
for two reasons: to try and balance the inactive and laundry queue sizes
("background laundering"), and to quickly make up for a shortage of free
pages and clean inactive pages ("shortfall laundering").  When background
laundering is requested, the laundry thread computes the number of page
daemon wakeups that have taken place since the last laundering.  If this
number is large enough relative to the ratio of the laundry and (global)
inactive queue sizes, we will launder vm_background_launder_target pages at
vm_background_launder_rate KB/s.  Otherwise, the laundry thread goes back
to sleep without doing any work.  When scanning the laundry queue during
background laundering, reactivated pages are counted towards the laundry
thread's target.

In contrast, shortfall laundering is requested when an inactive queue scan
fails to meet its target.  In this case, the laundry thread attempts to
launder enough pages to meet v_free_target within 0.5s, which is the
inactive queue scan period.

A laundry request can be latched while another is currently being
serviced.  In particular, a shortfall request will immediately preempt a
background laundering.

This change also redefines the meaning of vm_cnt.v_reactivated and removes
the functions vm_page_cache() and vm_page_try_to_cache().  The new meaning
of vm_cnt.v_reactivated now better reflects its name.  It represents the
number of inactive or laundry pages that are returned to the active queue
on account of a reference.

In collaboration with:	markj
Reviewed by:	kib
Tested by:	pho
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8302
2016-11-09 18:48:37 +00:00
..
amd64 Fix improper use of "its". 2016-11-08 23:59:41 +00:00
arm Fix improper use of "its". 2016-11-08 23:59:41 +00:00
arm64 Fix improper use of "its". 2016-11-08 23:59:41 +00:00
boot Add the DTS for the Netgate SG-1000 (micro-Firewall). 2016-11-09 04:07:15 +00:00
bsm
cam Fix improper use of "its". 2016-11-08 23:59:41 +00:00
cddl Fix improper use of "its". 2016-11-08 23:59:41 +00:00
compat Tidy up ia32_sysvec sv_flags setting 2016-10-20 20:29:54 +00:00
conf Refactor FDT part of gpioled driver 2016-11-07 21:15:39 +00:00
contrib Fix improper use of "its". 2016-11-08 23:59:41 +00:00
crypto Fix C++ includability of crypto headers with static array sizes 2016-10-18 23:20:49 +00:00
ddb Determine the operand/address size of %cs in a new function 2016-09-25 16:30:29 +00:00
dev Fix copy/paste bug in r308464. 2016-11-09 17:57:55 +00:00
fs Fix improper use of "its". 2016-11-08 23:59:41 +00:00
gdb
geom Fix improper use of "its". 2016-11-08 23:59:41 +00:00
gnu Revert and redo r306083. 2016-09-22 15:17:36 +00:00
i386 Fix improper use of "its". 2016-11-08 23:59:41 +00:00
isa
kern Fix improper use of "its". 2016-11-08 23:59:41 +00:00
kgssapi
libkern
mips Use correct signal number for floating point exceptions. 2016-10-31 15:49:41 +00:00
modules Add the DTS for the Netgate SG-1000 (micro-Firewall). 2016-11-09 04:07:15 +00:00
net Various fixes for ptnet/ptnetmap (passthrough of netmap ports). In detail: 2016-10-27 09:46:22 +00:00
net80211 Fix improper use of "its". 2016-11-08 23:59:41 +00:00
netgraph Fix improper use of "its". 2016-11-08 23:59:41 +00:00
netinet Initialize ip6 pointer before use. 2016-11-06 02:33:04 +00:00
netinet6 Make ICMPv6 hard error handling for TCP consistent with the ICMPv4 2016-10-21 10:32:57 +00:00
netipsec Remove the 4.3BSD compatible macro m_copy(), use m_copym() instead. 2016-09-15 07:41:48 +00:00
netnatm
netpfil Remove the mbuf tag after use (for reinjected packets). 2016-11-03 00:26:58 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Move the ConnectX-3 and ConnectX-2 driver from sys/ofed into sys/dev/mlx4 2016-09-30 08:23:06 +00:00
opencrypto Add support for the fpu_kern(9) KPI on arm64. It hooks into the existing 2016-10-20 09:22:10 +00:00
pc98 Fix building on i386 and arm. But 'public domain' headers on the files 2016-10-13 06:56:23 +00:00
powerpc Fix improper use of "its". 2016-11-08 23:59:41 +00:00
riscv System Binary Interface (SBI) page was moved in latest version of 2016-11-04 13:07:54 +00:00
rpc
security Fix improper use of "its". 2016-11-08 23:59:41 +00:00
sparc64 Fix building on i386 and arm. But 'public domain' headers on the files 2016-10-13 06:56:23 +00:00
sys Introduce a new page queue, PQ_LAUNDRY, for storing unreferenced, dirty 2016-11-09 18:48:37 +00:00
teken
tests
tools
ufs ANSIfy ffs_subr.c 2016-10-31 20:43:43 +00:00
vm Introduce a new page queue, PQ_LAUNDRY, for storing unreferenced, dirty 2016-11-09 18:48:37 +00:00
x86 Fix improper use of "its". 2016-11-08 23:59:41 +00:00
xdr
xen xen: add a grant-table user-space device 2016-10-31 13:12:58 +00:00
Makefile