From owner-svn-src-user@FreeBSD.ORG Sat May 12 19:22:58 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0E5C106564A; Sat, 12 May 2012 19:22: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 776D58FC08; Sat, 12 May 2012 19:22: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 q4CJMwju047733; Sat, 12 May 2012 19:22:58 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4CJMwBs047730; Sat, 12 May 2012 19:22:58 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201205121922.q4CJMwBs047730@svn.freebsd.org> From: Attilio Rao Date: Sat, 12 May 2012 19:22: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: r235349 - user/attilio/vmcontention/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: Sat, 12 May 2012 19:22:59 -0000 Author: attilio Date: Sat May 12 19:22:57 2012 New Revision: 235349 URL: http://svn.freebsd.org/changeset/base/235349 Log: - Fix a bug where lookupn can wrap up looking for the pages to scan, returning a non correct very low address again. - Stub out vm_lookup_foreach as it is not used Modified: user/attilio/vmcontention/sys/vm/vm_radix.c user/attilio/vmcontention/sys/vm/vm_radix.h Modified: user/attilio/vmcontention/sys/vm/vm_radix.c ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.c Sat May 12 18:11:26 2012 (r235348) +++ user/attilio/vmcontention/sys/vm/vm_radix.c Sat May 12 19:22:57 2012 (r235349) @@ -638,15 +638,37 @@ vm_radix_lookupn(struct vm_radix *rtree, if (end != 0 && start >= end) goto out; val = vm_radix_match(rnode->rn_child[slot], color); - if (val == NULL) + if (val == NULL) { + + /* + * The start address can wrap at the + * VM_RADIX_MAXVAL value. + * We need to make sure that start address + * point to the next chunk (even if wrapping) + * to stay consistent with default scanning + * behaviour. Also, because of the nature + * of the wrapping, the wrap up checks must + * be done after all the necessary controls + * on start are completed. + */ + if ((VM_RADIX_MAXVAL - start) == 0) { + start++; + goto out; + } continue; + } CTR4(KTR_VM, "lookupn: tree %p index %ju slot %d found child %p", rtree, (uintmax_t)start, slot, val); out[outidx] = val; if (++outidx == cnt) goto out; - } + if ((VM_RADIX_MAXVAL - start) == 0) { + start++; + goto out; + } + } + MPASS((VM_RADIX_MAXVAL - start) != 0); if (end != 0 && start >= end) break; } @@ -655,6 +677,7 @@ out: return (outidx); } +#if 0 void vm_radix_foreach(struct vm_radix *rtree, vm_pindex_t start, vm_pindex_t end, int color, void (*iter)(void *)) @@ -678,6 +701,7 @@ vm_radix_foreach(struct vm_radix *rtree, return; } } +#endif /* Modified: user/attilio/vmcontention/sys/vm/vm_radix.h ============================================================================== --- user/attilio/vmcontention/sys/vm/vm_radix.h Sat May 12 18:11:26 2012 (r235348) +++ user/attilio/vmcontention/sys/vm/vm_radix.h Sat May 12 19:22:57 2012 (r235349) @@ -64,8 +64,6 @@ int vm_radix_lookupn(struct vm_radix *, void *vm_radix_lookup_le(struct vm_radix *, vm_pindex_t, int); void vm_radix_reclaim_allnodes(struct vm_radix *); void *vm_radix_remove(struct vm_radix *, vm_pindex_t, int); -void vm_radix_foreach(struct vm_radix *, vm_pindex_t, vm_pindex_t, int, - void (*)(void *)); /* * Look up any entry at a position greater or equal to index.