]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/vm/vm_page.h
Add support for multithreading the inactive queue pageout within a domain.
authorcem <cem@FreeBSD.org>
Tue, 11 Aug 2020 20:37:45 +0000 (20:37 +0000)
committercem <cem@FreeBSD.org>
Tue, 11 Aug 2020 20:37:45 +0000 (20:37 +0000)
commit0dfcfcb055ce15cfdd4f96371bf4114ae9e5d98e
tree6d34069dd94e6e242bf2b3f386e29b385b41ce29
parentac03955bf54d75d3093fb9cd43dc2a2cb070fe42
Add support for multithreading the inactive queue pageout within a domain.

In very high throughput workloads, the inactive scan can become overwhelmed
as you have many cores producing pages and a single core freeing.  Since
Mark's introduction of batched pagequeue operations, we can now run multiple
inactive threads working on independent batches.

To avoid confusing the pid and other control algorithms, I (Jeff) do this in
a mpi-like fan out and collect model that is driven from the primary page
daemon.  It decides whether the shortfall can be overcome with a single
thread and if not dispatches multiple threads and waits for their results.

The heuristic is based on timing the pageout activity and averaging a
pages-per-second variable which is exponentially decayed. This is visible in
sysctl and may be interesting for other purposes.

I (Jeff) have verified that this does indeed double our paging throughput
when used with two threads. With four we tend to run into other contention
problems.  For now I would like to commit this infrastructure with only a
single thread enabled.

The number of worker threads per domain can be controlled with the
'vm.pageout_threads_per_domain' tunable.

Submitted by: jeff (earlier version)
Discussed with: markj
Tested by: pho
Sponsored by: probably Netflix (based on contemporary commits)
Differential Revision: https://reviews.freebsd.org/D21629
sys/vm/vm_meter.c
sys/vm/vm_page.c
sys/vm/vm_page.h
sys/vm/vm_pageout.c
sys/vm/vm_pagequeue.h