From owner-svn-src-stable-8@FreeBSD.ORG Tue Nov 17 18:31:10 2009 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6DC1065697; Tue, 17 Nov 2009 18:31:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED8648FC08; Tue, 17 Nov 2009 18:31:09 +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 nAHIV9Aw029119; Tue, 17 Nov 2009 18:31:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHIV9fZ029117; Tue, 17 Nov 2009 18:31:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200911171831.nAHIV9fZ029117@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 17 Nov 2009 18:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199415 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Nov 2009 18:31:10 -0000 Author: kib Date: Tue Nov 17 18:31:09 2009 New Revision: 199415 URL: http://svn.freebsd.org/changeset/base/199415 Log: MFC r198476 (by alc): Simplify the inner loop of vm_fault_copy_entry(). Approved by: alc Modified: stable/8/sys/vm/vm_fault.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/vm_fault.c ============================================================================== --- stable/8/sys/vm/vm_fault.c Tue Nov 17 18:22:14 2009 (r199414) +++ stable/8/sys/vm/vm_fault.c Tue Nov 17 18:31:09 2009 (r199415) @@ -1133,20 +1133,20 @@ vm_fault_copy_entry(vm_map_t dst_map, vm { vm_object_t backing_object, dst_object, object; vm_object_t src_object; - vm_ooffset_t dst_offset; - vm_ooffset_t src_offset; - vm_pindex_t pindex; + vm_pindex_t dst_pindex, pindex, src_pindex; vm_prot_t prot; vm_offset_t vaddr; vm_page_t dst_m; vm_page_t src_m; + boolean_t src_readonly; #ifdef lint src_map++; #endif /* lint */ src_object = src_entry->object.vm_object; - src_offset = src_entry->offset; + src_pindex = OFF_TO_IDX(src_entry->offset); + src_readonly = (src_entry->protection & VM_PROT_WRITE) == 0; /* * Create the top-level object for the destination entry. (Doesn't @@ -1177,16 +1177,16 @@ vm_fault_copy_entry(vm_map_t dst_map, vm * one from the source object (it should be there) to the destination * object. */ - for (vaddr = dst_entry->start, dst_offset = 0; + for (vaddr = dst_entry->start, dst_pindex = 0; vaddr < dst_entry->end; - vaddr += PAGE_SIZE, dst_offset += PAGE_SIZE) { + vaddr += PAGE_SIZE, dst_pindex++) { /* - * Allocate a page in the destination object + * Allocate a page in the destination object. */ do { - dst_m = vm_page_alloc(dst_object, - OFF_TO_IDX(dst_offset), VM_ALLOC_NORMAL); + dst_m = vm_page_alloc(dst_object, dst_pindex, + VM_ALLOC_NORMAL); if (dst_m == NULL) { VM_OBJECT_UNLOCK(dst_object); VM_WAIT; @@ -1201,10 +1201,9 @@ vm_fault_copy_entry(vm_map_t dst_map, vm */ VM_OBJECT_LOCK(src_object); object = src_object; - pindex = 0; - while ((src_m = vm_page_lookup(object, pindex + - OFF_TO_IDX(dst_offset + src_offset))) == NULL && - (src_entry->protection & VM_PROT_WRITE) == 0 && + pindex = src_pindex + dst_pindex; + while ((src_m = vm_page_lookup(object, pindex)) == NULL && + src_readonly && (backing_object = object->backing_object) != NULL) { /* * Allow fallback to backing objects if we are reading.