From owner-svn-src-head@freebsd.org Fri May 27 06:05:14 2016 Return-Path: Delivered-To: svn-src-head@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 25A48B4C602; Fri, 27 May 2016 06:05:14 +0000 (UTC) (envelope-from alc@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 CD5C5194D; Fri, 27 May 2016 06:05:13 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4R65CLu020003; Fri, 27 May 2016 06:05:12 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4R65CNf020002; Fri, 27 May 2016 06:05:12 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201605270605.u4R65CNf020002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Fri, 27 May 2016 06:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300826 - 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-head@freebsd.org X-Mailman-Version: 2.1.22 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: Fri, 27 May 2016 06:05:14 -0000 Author: alc Date: Fri May 27 06:05:12 2016 New Revision: 300826 URL: https://svnweb.freebsd.org/changeset/base/300826 Log: Use vm_page_replace_checked() instead of vm_page_rename() for implementing optimized copy-on-write faults. This has two advantages: (1) one less radix tree operation is performed and (2) vm_page_replace_checked() cannot fail, making the code simpler. Submitted by: Ryan Libby Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D4478 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Fri May 27 05:58:53 2016 (r300825) +++ head/sys/vm/vm_fault.c Fri May 27 06:05:12 2016 (r300826) @@ -799,26 +799,15 @@ vnode_locked: * We don't chase down the shadow chain */ fs.object == fs.first_object->backing_object) { - /* - * get rid of the unnecessary page - */ - vm_page_lock(fs.first_m); - vm_page_remove(fs.first_m); - vm_page_unlock(fs.first_m); - /* - * grab the page and put it into the - * process'es object. The page is - * automatically made dirty. - */ - if (vm_page_rename(fs.m, fs.first_object, - fs.first_pindex)) { - VM_OBJECT_WUNLOCK(fs.first_object); - unlock_and_deallocate(&fs); - goto RetryFault; - } + vm_page_lock(fs.m); + vm_page_remove(fs.m); + vm_page_unlock(fs.m); vm_page_lock(fs.first_m); + vm_page_replace_checked(fs.m, fs.first_object, + fs.first_pindex, fs.first_m); vm_page_free(fs.first_m); vm_page_unlock(fs.first_m); + vm_page_dirty(fs.m); #if VM_NRESERVLEVEL > 0 /* * Rename the reservation. @@ -827,6 +816,10 @@ vnode_locked: fs.object, OFF_TO_IDX( fs.first_object->backing_object_offset)); #endif + /* + * Removing the page from the backing object + * unbusied it. + */ vm_page_xbusy(fs.m); fs.first_m = fs.m; fs.m = NULL;