From owner-svn-src-all@freebsd.org Thu May 24 20:26:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 610BBEFD408; Thu, 24 May 2018 20:26:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8C2082224; Thu, 24 May 2018 20:26:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DDED17205; Thu, 24 May 2018 20:26:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4OKQbhT088804; Thu, 24 May 2018 20:26:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4OKQbug088803; Thu, 24 May 2018 20:26:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201805242026.w4OKQbug088803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 24 May 2018 20:26:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334179 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 334179 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2018 20:26:40 -0000 Author: markj Date: Thu May 24 20:26:37 2018 New Revision: 334179 URL: https://svnweb.freebsd.org/changeset/base/334179 Log: Update r334154 with review feedback from D15490. An old revision was committed by accident. Differential Revision: https://reviews.freebsd.org/D15490 Modified: head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Thu May 24 18:53:29 2018 (r334178) +++ head/sys/vm/vm_pageout.c Thu May 24 20:26:37 2018 (r334179) @@ -1111,16 +1111,16 @@ dolaundry: * Compute the number of pages we want to try to move from the * active queue to either the inactive or laundry queue. * - * When scanning active pages, we make clean pages count more heavily - * towards the page shortage than dirty pages. This is because dirty - * pages must be laundered before they can be reused and thus have less - * utility when attempting to quickly alleviate a shortage. However, - * this weighting also causes the scan to deactivate dirty pages more - * aggressively, improving the effectiveness of clustering and - * ensuring that they can eventually be reused. + * When scanning active pages during a shortage, we make clean pages + * count more heavily towards the page shortage than dirty pages. + * This is because dirty pages must be laundered before they can be + * reused and thus have less utility when attempting to quickly + * alleviate a free page shortage. However, this weighting also + * causes the scan to deactivate dirty pages more aggressively, + * improving the effectiveness of clustering. */ static int -vm_pageout_scan_active_target(struct vm_domain *vmd) +vm_pageout_active_target(struct vm_domain *vmd) { int shortage; @@ -1169,12 +1169,12 @@ vm_pageout_scan_active(struct vm_domain *vmd, int page * candidates. Held pages may be deactivated. * * To avoid requeuing each page that remains in the active queue, we - * implement the CLOCK algorithm. To maintain consistency in the - * generic page queue code, pages are inserted at the tail of the - * active queue. We thus use two hands, represented by marker pages: - * scans begin at the first hand, which precedes the second hand in - * the queue. When the two hands meet, they are moved back to the - * head and tail of the queue, respectively, and scanning resumes. + * implement the CLOCK algorithm. To keep the implementation of the + * enqueue operation consistent for all page queues, we use two hands, + * represented by marker pages. Scans begin at the first hand, which + * precedes the second hand in the queue. When the two hands meet, + * they are moved back to the head and tail of the queue, respectively, + * and scanning resumes. */ max_scan = page_shortage > 0 ? pq->pq_cnt : min_scan; mtx = NULL; @@ -1254,9 +1254,12 @@ act_scan: * through the inactive queue before moving to the * laundry queues. This gives them some extra time to * be reactivated, potentially avoiding an expensive - * pageout. During a page shortage, the inactive queue - * is necessarily small, so we may move dirty pages - * directly to the laundry queue. + * pageout. However, during a page shortage, the + * inactive queue is necessarily small, and so dirty + * pages would only spend a trivial amount of time in + * the inactive queue. Therefore, we might as well + * place them directly in the laundry queue to reduce + * queuing overhead. */ if (page_shortage <= 0) vm_page_deactivate(m); @@ -1941,7 +1944,7 @@ vm_pageout_worker(void *arg) * indicates that we must aggressively deactivate pages to avoid * a shortfall. */ - shortage = vm_pageout_scan_active_target(vmd) + addl_shortage; + shortage = vm_pageout_active_target(vmd) + addl_shortage; vm_pageout_scan_active(vmd, shortage); /*