From owner-svn-src-all@FreeBSD.ORG Sat Apr 28 18:03:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 97BD4106566C; Sat, 28 Apr 2012 18:03:58 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A1C88FC0A; Sat, 28 Apr 2012 18:03:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3SI3w5b073801; Sat, 28 Apr 2012 18:03:58 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3SI3wXa073799; Sat, 28 Apr 2012 18:03:58 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201204281803.q3SI3wXa073799@svn.freebsd.org> From: Alan Cox Date: Sat, 28 Apr 2012 18:03:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234765 - in stable/9/sys: amd64/amd64 i386/conf kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 28 Apr 2012 18:03:58 -0000 Author: alc Date: Sat Apr 28 18:03:57 2012 New Revision: 234765 URL: http://svn.freebsd.org/changeset/base/234765 Log: MFC r233097 With the changes over the past year to how accesses to the page's dirty field are synchronized, there is no need for pmap_protect() to acquire the page queues lock unless it is going to access the pv lists. Modified: stable/9/sys/amd64/amd64/pmap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) stable/9/sys/kern/subr_witness.c (props changed) Modified: stable/9/sys/amd64/amd64/pmap.c ============================================================================== --- stable/9/sys/amd64/amd64/pmap.c Sat Apr 28 17:54:54 2012 (r234764) +++ stable/9/sys/amd64/amd64/pmap.c Sat Apr 28 18:03:57 2012 (r234765) @@ -2893,6 +2893,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv pd_entry_t ptpaddr, *pde; pt_entry_t *pte; int anychanged; + boolean_t pv_lists_locked; if ((prot & VM_PROT_READ) == VM_PROT_NONE) { pmap_remove(pmap, sva, eva); @@ -2903,9 +2904,10 @@ pmap_protect(pmap_t pmap, vm_offset_t sv (VM_PROT_WRITE|VM_PROT_EXECUTE)) return; + pv_lists_locked = FALSE; +resume: anychanged = 0; - vm_page_lock_queues(); PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { @@ -2954,9 +2956,25 @@ pmap_protect(pmap_t pmap, vm_offset_t sv if (pmap_protect_pde(pmap, pde, sva, prot)) anychanged = 1; continue; - } else if (!pmap_demote_pde(pmap, pde, sva)) { - /* The large page mapping was destroyed. */ - continue; + } else { + if (!pv_lists_locked) { + pv_lists_locked = TRUE; + if (!mtx_trylock(&vm_page_queue_mtx)) { + if (anychanged) + pmap_invalidate_all( + pmap); + PMAP_UNLOCK(pmap); + vm_page_lock_queues(); + goto resume; + } + } + if (!pmap_demote_pde(pmap, pde, sva)) { + /* + * The large page mapping was + * destroyed. + */ + continue; + } } } @@ -2996,7 +3014,8 @@ retry: } if (anychanged) pmap_invalidate_all(pmap); - vm_page_unlock_queues(); + if (pv_lists_locked) + vm_page_unlock_queues(); PMAP_UNLOCK(pmap); }