From owner-svn-src-user@FreeBSD.ORG Sun Jul 8 23:50:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DC431065670; Sun, 8 Jul 2012 23:50:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3915B8FC16; Sun, 8 Jul 2012 23:50: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 q68Now6i082129; Sun, 8 Jul 2012 23:50:58 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q68Now16082126; Sun, 8 Jul 2012 23:50:58 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201207082350.q68Now16082126@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 Jul 2012 23:50:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238269 - user/attilio/vmc-playground/sys/vm X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Jul 2012 23:50:58 -0000 Author: attilio Date: Sun Jul 8 23:50:57 2012 New Revision: 238269 URL: http://svn.freebsd.org/changeset/base/238269 Log: - Move VM_RADIX_STACK in vm_object.c because it is the only consumer - Import the check for the return value of vm_radix_lookup() directly in the while removing the need to use a spourious check. Modified: user/attilio/vmc-playground/sys/vm/vm_object.c user/attilio/vmc-playground/sys/vm/vm_radix.h Modified: user/attilio/vmc-playground/sys/vm/vm_object.c ============================================================================== --- user/attilio/vmc-playground/sys/vm/vm_object.c Sun Jul 8 23:20:15 2012 (r238268) +++ user/attilio/vmc-playground/sys/vm/vm_object.c Sun Jul 8 23:50:57 2012 (r238269) @@ -96,6 +96,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define VM_RADIX_STACK 8 /* Nodes to store on stack for ranged ops. */ + static int old_msync; SYSCTL_INT(_vm, OID_AUTO, old_msync, CTLFLAG_RW, &old_msync, 0, "Use old (insecure) msync behavior"); @@ -729,8 +731,10 @@ vm_object_terminate(vm_object_t object) */ start = 0; exhausted = 0; - while (exhausted == 0 && (n = vm_radix_lookupn(&object->rtree, start, - 0, (void **)pa, VM_RADIX_STACK, &start, &exhausted)) != 0) { + n = VM_RADIX_STACK; + while (n == VM_RADIX_STACK && exhausted == 0 && + (n = vm_radix_lookupn(&object->rtree, start, 0, (void **)pa, + VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; KASSERT(!p->busy && (p->oflags & VPO_BUSY) == 0, @@ -755,8 +759,6 @@ vm_object_terminate(vm_object_t object) } vm_page_unlock(p); } - if (n < VM_RADIX_STACK) - break; } vm_radix_reclaim_allnodes(&object->rtree); vp = NULL; @@ -764,9 +766,10 @@ vm_object_terminate(vm_object_t object) mtx_lock(&vm_page_queue_free_mtx); start = 0; exhausted = 0; - while (exhausted == 0 && (n = vm_radix_lookupn(&object->cache, - start, 0, (void **)pa, VM_RADIX_STACK, &start, - &exhausted)) != 0) { + n = VM_RADIX_STACK; + while (n == VM_RADIX_STACK && exhausted == 0 && + (n = vm_radix_lookupn(&object->cache, start, 0, + (void **)pa, VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; MPASS(p->object == object); @@ -787,8 +790,6 @@ vm_object_terminate(vm_object_t object) if (object->type == OBJT_VNODE) vp = object->handle; } - if (n < VM_RADIX_STACK) - break; } vm_radix_reclaim_allnodes(&object->cache); mtx_unlock(&vm_page_queue_free_mtx); @@ -1389,8 +1390,10 @@ vm_object_split(vm_map_entry_t entry) start = offidxstart; retry: exhausted = 0; - while (exhausted == 0 && (n = vm_radix_lookupn(&orig_object->rtree, - start, offidxstart + size, (void **)ma, VM_RADIX_STACK, &start, + n = VM_RADIX_STACK; + while (n == VM_RADIX_STACK && exhausted == 0 && + (n = vm_radix_lookupn(&orig_object->rtree, start, + offidxstart + size, (void **)ma, VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { m = ma[i]; @@ -1438,8 +1441,6 @@ retry: */ vm_page_busy(m); } - if (n < VM_RADIX_STACK) - break; } if (orig_object->type == OBJT_SWAP) { /* @@ -1454,8 +1455,9 @@ retry: if (!vm_object_cache_is_empty(orig_object)) { start = offidxstart; exhausted = 0; + n = VM_RADIX_STACK; mtx_lock(&vm_page_queue_free_mtx); - while (exhausted == 0 && + while (n == VM_RADIX_STACK && exhausted == 0 && (n = vm_radix_lookupn(&orig_object->cache, start, offidxstart + size, (void **)ma, VM_RADIX_STACK, &start, &exhausted)) != 0) { @@ -1465,8 +1467,6 @@ retry: vm_page_cache_rename(m, new_object, idx); } - if (n < VM_RADIX_STACK) - break; } mtx_unlock(&vm_page_queue_free_mtx); } @@ -1532,9 +1532,7 @@ restart: exhausted = 0; for (;;) { if (i == n) { - if (n < VM_RADIX_STACK) - break; - if (exhausted != 0 || + if (n < VM_RADIX_STACK || exhausted != 0 || (n = vm_radix_lookupn(&backing_object->rtree, start, 0, (void **)pa, VM_RADIX_STACK, &start, &exhausted)) == 0) @@ -1827,16 +1825,16 @@ vm_object_collapse(vm_object_t object) */ start = 0; exhausted = 0; + n = VM_RADIX_STACK; mtx_lock(&vm_page_queue_free_mtx); - while (exhausted == 0 && (n = + while (n == VM_RADIX_STACK && + exhausted == 0 && (n = vm_radix_lookupn(&backing_object->cache, start, 0, (void **)pa, VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) vm_page_cache_free(pa[i]); - if (n < VM_RADIX_STACK) - break; } mtx_unlock(&vm_page_queue_free_mtx); } @@ -1981,8 +1979,10 @@ vm_object_page_remove(vm_object_t object cstart = start; restart: exhausted = 0; - while (exhausted == 0 && (n = vm_radix_lookupn(&object->rtree, start, - end, (void **)pa, VM_RADIX_STACK, &start, &exhausted)) != 0) { + n = VM_RADIX_STACK; + while (n == VM_RADIX_STACK && exhausted == 0 && + (n = vm_radix_lookupn(&object->rtree, start, end, (void **)pa, + VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; @@ -2039,17 +2039,16 @@ restart: vm_page_free(p); vm_page_unlock(p); } - if (n < VM_RADIX_STACK) - break; } vm_object_pip_wakeup(object); if (!vm_object_cache_is_empty(object)) { start = cstart; exhausted = 0; + n = VM_RADIX_STACK; mtx_lock(&vm_page_queue_free_mtx); - while (exhausted == 0 && (n = vm_radix_lookupn(&object->cache, - start, end, (void **)pa, VM_RADIX_STACK, &start, - &exhausted)) != 0) { + while (n == VM_RADIX_STACK && exhausted == 0 && + (n = vm_radix_lookupn(&object->cache, start, end, + (void **)pa, VM_RADIX_STACK, &start, &exhausted)) != 0) { for (i = 0; i < n; i++) { p = pa[i]; vm_page_cache_free(p); @@ -2057,8 +2056,6 @@ restart: object->type == OBJT_VNODE) vp = object->handle; } - if (n < VM_RADIX_STACK) - break; } mtx_unlock(&vm_page_queue_free_mtx); } Modified: user/attilio/vmc-playground/sys/vm/vm_radix.h ============================================================================== --- user/attilio/vmc-playground/sys/vm/vm_radix.h Sun Jul 8 23:20:15 2012 (r238268) +++ user/attilio/vmc-playground/sys/vm/vm_radix.h Sun Jul 8 23:50:57 2012 (r238269) @@ -29,8 +29,6 @@ #ifndef _VM_RADIX_H_ #define _VM_RADIX_H_ -#define VM_RADIX_STACK 8 /* Nodes to store on stack. */ - /* * Radix tree root. The height and pointer are set together to permit * coherent lookups while the root is modified.