From owner-svn-src-head@FreeBSD.ORG Sun May 30 18:48:41 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B957B106566B; Sun, 30 May 2010 18:48:41 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7398FC17; Sun, 30 May 2010 18:48:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4UImfCH025936; Sun, 30 May 2010 18:48:41 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4UImfXE025932; Sun, 30 May 2010 18:48:41 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201005301848.o4UImfXE025932@svn.freebsd.org> From: Alan Cox Date: Sun, 30 May 2010 18:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208657 - in head/sys: amd64/amd64 i386/i386 i386/xen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 30 May 2010 18:48:41 -0000 Author: alc Date: Sun May 30 18:48:41 2010 New Revision: 208657 URL: http://svn.freebsd.org/changeset/base/208657 Log: Simplify the inner loop of pmap_collect(): While iterating over the page's pv list, there is no point in checking whether or not the pv list is empty. Instead, wait until the loop completes. Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/amd64/amd64/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2041,7 +2041,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2077,15 +2076,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/i386/i386/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2147,7 +2147,6 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll static void pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq) { - struct md_page *pvh; pd_entry_t *pde; pmap_t pmap; pt_entry_t *pte, tpte; @@ -2184,15 +2183,13 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) { - pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); - if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - } free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list) && + TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); } Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Sun May 30 14:20:32 2010 (r208656) +++ head/sys/i386/xen/pmap.c Sun May 30 18:48:41 2010 (r208657) @@ -2078,12 +2078,12 @@ pmap_collect(pmap_t locked_pmap, struct pmap_invalidate_page(pmap, va); pmap_free_zero_pages(free); TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); free_pv_entry(pmap, pv); if (pmap != locked_pmap) PMAP_UNLOCK(pmap); } + if (TAILQ_EMPTY(&m->md.pv_list)) + vm_page_flag_clear(m, PG_WRITEABLE); } sched_unpin(); }