svn commit: r364129 - head/sys/vm

Mark Johnston markj at freebsd.org
Tue Aug 11 21:51:12 UTC 2020


On Tue, Aug 11, 2020 at 08:37:45PM +0000, Conrad Meyer wrote:
> Author: cem
> Date: Tue Aug 11 20:37:45 2020
> New Revision: 364129
> URL: https://svnweb.freebsd.org/changeset/base/364129
> 
> Log:
>   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
> 
> Modified:
>   head/sys/vm/vm_meter.c
>   head/sys/vm/vm_page.c
>   head/sys/vm/vm_page.h
>   head/sys/vm/vm_pageout.c
>   head/sys/vm/vm_pagequeue.h
> 
> Modified: head/sys/vm/vm_page.c
> ==============================================================================
> --- head/sys/vm/vm_page.c	Tue Aug 11 17:54:10 2020	(r364128)
> +++ head/sys/vm/vm_page.c	Tue Aug 11 20:37:45 2020	(r364129)
> @@ -421,7 +421,7 @@ sysctl_vm_page_blacklist(SYSCTL_HANDLER_ARGS)
>   * In principle, this function only needs to set the flag PG_MARKER.
>   * Nonetheless, it write busies the page as a safety precaution.
>   */
> -static void
> +void
>  vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags)
>  {
>  
> @@ -2488,7 +2488,7 @@ vm_page_zone_import(void *arg, void **store, int cnt, 
>  	 * main purpose is to replenish the store of free pages.
>  	 */
>  	if (vmd->vmd_severeset || curproc == pageproc ||
> -	    !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt))
> +	    !_vm_domain_allocate(vmd, VM_ALLOC_SYSTEM, cnt))

Why did this change?  It does not look related to the rest of the
change.


More information about the svn-src-all mailing list