From owner-svn-src-stable@freebsd.org Tue May 8 10:18:25 2018 Return-Path: Delivered-To: svn-src-stable@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 7F46BFB03BF; Tue, 8 May 2018 10:18:25 +0000 (UTC) (envelope-from kib@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 2D79383A30; Tue, 8 May 2018 10:18:25 +0000 (UTC) (envelope-from kib@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 0E9D628EAB; Tue, 8 May 2018 10:18:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w48AIOv7025467; Tue, 8 May 2018 10:18:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w48AIOIj025466; Tue, 8 May 2018 10:18:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201805081018.w48AIOIj025466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 May 2018 10:18:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r333360 - stable/11/sys/vm X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/vm X-SVN-Commit-Revision: 333360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2018 10:18:25 -0000 Author: kib Date: Tue May 8 10:18:24 2018 New Revision: 333360 URL: https://svnweb.freebsd.org/changeset/base/333360 Log: MFC r333091: Eliminate some vm object relocks in vm fault. Approved by: re (marius) Modified: stable/11/sys/vm/vm_fault.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_fault.c ============================================================================== --- stable/11/sys/vm/vm_fault.c Tue May 8 10:03:32 2018 (r333359) +++ stable/11/sys/vm/vm_fault.c Tue May 8 10:18:24 2018 (r333360) @@ -130,7 +130,7 @@ struct faultstate { static void vm_fault_dontneed(const struct faultstate *fs, vm_offset_t vaddr, int ahead); static void vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra, - int backward, int forward); + int backward, int forward, bool obj_locked); static inline void release_page(struct faultstate *fs) @@ -318,9 +318,9 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t return (rv); vm_fault_fill_hold(m_hold, m); vm_fault_dirty(fs->entry, m, prot, fault_type, fault_flags, false); - VM_OBJECT_RUNLOCK(fs->first_object); if (psind == 0 && !wired) - vm_fault_prefault(fs, vaddr, PFBAK, PFFOR); + vm_fault_prefault(fs, vaddr, PFBAK, PFFOR, true); + VM_OBJECT_RUNLOCK(fs->first_object); vm_map_lookup_done(fs->map, fs->entry); curthread->td_ru.ru_minflt++; return (KERN_SUCCESS); @@ -1262,7 +1262,7 @@ readrest: wired == 0) vm_fault_prefault(&fs, vaddr, faultcount > 0 ? behind : PFBAK, - faultcount > 0 ? ahead : PFFOR); + faultcount > 0 ? ahead : PFFOR, false); VM_OBJECT_WLOCK(fs.object); vm_page_lock(fs.m); @@ -1394,7 +1394,7 @@ vm_fault_dontneed(const struct faultstate *fs, vm_offs */ static void vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra, - int backward, int forward) + int backward, int forward, bool obj_locked) { pmap_t pmap; vm_map_entry_t entry; @@ -1440,7 +1440,8 @@ vm_fault_prefault(const struct faultstate *fs, vm_offs pindex = ((addr - entry->start) + entry->offset) >> PAGE_SHIFT; lobject = entry->object.vm_object; - VM_OBJECT_RLOCK(lobject); + if (!obj_locked) + VM_OBJECT_RLOCK(lobject); while ((m = vm_page_lookup(lobject, pindex)) == NULL && lobject->type == OBJT_DEFAULT && (backing_object = lobject->backing_object) != NULL) { @@ -1448,17 +1449,20 @@ vm_fault_prefault(const struct faultstate *fs, vm_offs 0, ("vm_fault_prefault: unaligned object offset")); pindex += lobject->backing_object_offset >> PAGE_SHIFT; VM_OBJECT_RLOCK(backing_object); - VM_OBJECT_RUNLOCK(lobject); + if (!obj_locked || lobject != entry->object.vm_object) + VM_OBJECT_RUNLOCK(lobject); lobject = backing_object; } if (m == NULL) { - VM_OBJECT_RUNLOCK(lobject); + if (!obj_locked || lobject != entry->object.vm_object) + VM_OBJECT_RUNLOCK(lobject); break; } if (m->valid == VM_PAGE_BITS_ALL && (m->flags & PG_FICTITIOUS) == 0) pmap_enter_quick(pmap, addr, m, entry->protection); - VM_OBJECT_RUNLOCK(lobject); + if (!obj_locked || lobject != entry->object.vm_object) + VM_OBJECT_RUNLOCK(lobject); } }