From owner-svn-src-head@freebsd.org Tue Aug 11 21:32:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F23DB3B806A; Tue, 11 Aug 2020 21:32:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BR5dg0JHrz44Hj; Tue, 11 Aug 2020 21:32:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 07BLWDQk011719 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 12 Aug 2020 00:32:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 07BLWDQk011719 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 07BLWDHQ011718; Wed, 12 Aug 2020 00:32:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 12 Aug 2020 00:32:13 +0300 From: Konstantin Belousov To: Conrad Meyer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r364129 - head/sys/vm Message-ID: <20200811213213.GT2551@kib.kiev.ua> References: <202008112037.07BKbjsL056699@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008112037.07BKbjsL056699@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4BR5dg0JHrz44Hj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Aug 2020 21:32:25 -0000 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_meter.c > ============================================================================== > --- head/sys/vm/vm_meter.c Tue Aug 11 17:54:10 2020 (r364128) > +++ head/sys/vm/vm_meter.c Tue Aug 11 20:37:45 2020 (r364129) > @@ -552,6 +552,9 @@ vm_domain_stats_init(struct vm_domain *vmd, struct sys > SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, > "free_severe", CTLFLAG_RD, &vmd->vmd_free_severe, 0, > "Severe free pages"); > + SYSCTL_ADD_UINT(NULL, SYSCTL_CHILDREN(oid), OID_AUTO, > + "inactive_pps", CTLFLAG_RD, &vmd->vmd_inactive_pps, 0, > + "inactive pages freed/second"); > > } > > > 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 this change needed ? > return (0); > domain = vmd->vmd_domain; > vm_domain_free_lock(vmd); >