Date: Sat, 12 May 2012 19:22:58 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r235349 - user/attilio/vmcontention/sys/vm Message-ID: <201205121922.q4CJMwBs047730@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205121922.q4CJMwBs047730>