From owner-svn-src-all@freebsd.org Sun Nov 8 01:36:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 595BDA22E9A; Sun, 8 Nov 2015 01:36:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 326981037; Sun, 8 Nov 2015 01:36:20 +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 tA81aJ9x062560; Sun, 8 Nov 2015 01:36:19 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tA81aJqQ062557; Sun, 8 Nov 2015 01:36:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201511080136.tA81aJqQ062557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 8 Nov 2015 01:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290529 - head/sys/vm X-SVN-Group: head 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.20 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: Sun, 08 Nov 2015 01:36:20 -0000 Author: markj Date: Sun Nov 8 01:36:18 2015 New Revision: 290529 URL: https://svnweb.freebsd.org/changeset/base/290529 Log: Ensure that deactivated pages that are not expected to be reused are reclaimed in FIFO order by the pagedaemon. Previously we would enqueue such pages at the head of the inactive queue, yielding a LIFO reclaim order. Reviewed by: alc MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Nov 8 00:54:41 2015 (r290528) +++ head/sys/vm/vm_page.c Sun Nov 8 01:36:18 2015 (r290529) @@ -2536,14 +2536,16 @@ vm_page_unwire(vm_page_t m, uint8_t queu * processes. This optimization causes one-time-use metadata to be * reused more quickly. * - * Normally athead is 0 resulting in LRU operation. athead is set - * to 1 if we want this page to be 'as if it were placed in the cache', - * except without unmapping it from the process address space. + * Normally noreuse is FALSE, resulting in LRU operation. noreuse is set + * to TRUE if we want this page to be 'as if it were placed in the cache', + * except without unmapping it from the process address space. In + * practice this is implemented by inserting the page at the head of the + * queue, using a marker page to guide FIFO insertion ordering. * * The page must be locked. */ static inline void -_vm_page_deactivate(vm_page_t m, int athead) +_vm_page_deactivate(vm_page_t m, boolean_t noreuse) { struct vm_pagequeue *pq; int queue; @@ -2554,7 +2556,7 @@ _vm_page_deactivate(vm_page_t m, int ath * Ignore if the page is already inactive, unless it is unlikely to be * reactivated. */ - if ((queue = m->queue) == PQ_INACTIVE && !athead) + if ((queue = m->queue) == PQ_INACTIVE && !noreuse) return; if (m->wire_count == 0 && (m->oflags & VPO_UNMANAGED) == 0) { pq = &vm_phys_domain(m)->vmd_pagequeues[PQ_INACTIVE]; @@ -2569,8 +2571,9 @@ _vm_page_deactivate(vm_page_t m, int ath vm_pagequeue_lock(pq); } m->queue = PQ_INACTIVE; - if (athead) - TAILQ_INSERT_HEAD(&pq->pq_pl, m, plinks.q); + if (noreuse) + TAILQ_INSERT_BEFORE(&vm_phys_domain(m)->vmd_inacthead, + m, plinks.q); else TAILQ_INSERT_TAIL(&pq->pq_pl, m, plinks.q); vm_pagequeue_cnt_inc(pq); @@ -2587,7 +2590,7 @@ void vm_page_deactivate(vm_page_t m) { - _vm_page_deactivate(m, 0); + _vm_page_deactivate(m, FALSE); } /* @@ -2600,7 +2603,7 @@ void vm_page_deactivate_noreuse(vm_page_t m) { - _vm_page_deactivate(m, 1); + _vm_page_deactivate(m, TRUE); } /* Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Sun Nov 8 00:54:41 2015 (r290528) +++ head/sys/vm/vm_page.h Sun Nov 8 01:36:18 2015 (r290529) @@ -229,6 +229,7 @@ struct vm_domain { int vmd_pass; /* local pagedaemon pass */ int vmd_last_active_scan; struct vm_page vmd_marker; /* marker for pagedaemon private use */ + struct vm_page vmd_inacthead; /* marker for LRU-defeating insertions */ }; extern struct vm_domain vm_dom[MAXMEMDOM]; Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Sun Nov 8 00:54:41 2015 (r290528) +++ head/sys/vm/vm_pageout.c Sun Nov 8 01:36:18 2015 (r290529) @@ -1630,6 +1630,9 @@ vm_pageout_worker(void *arg) KASSERT(domain->vmd_segs != 0, ("domain without segments")); domain->vmd_last_active_scan = ticks; vm_pageout_init_marker(&domain->vmd_marker, PQ_INACTIVE); + vm_pageout_init_marker(&domain->vmd_inacthead, PQ_INACTIVE); + TAILQ_INSERT_HEAD(&domain->vmd_pagequeues[PQ_INACTIVE].pq_pl, + &domain->vmd_inacthead, plinks.q); /* * The pageout daemon worker is never done, so loop forever.