- 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
This commit is contained in:
attilio 2012-05-12 19:22:57 +00:00
parent c7b668e647
commit 3bd53aaf3c
2 changed files with 26 additions and 4 deletions

View File

@ -638,15 +638,37 @@ vm_radix_lookupn(struct vm_radix *rtree, vm_pindex_t start,
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, vm_pindex_t start, vm_pindex_t end,
return;
}
}
#endif
/*

View File

@ -64,8 +64,6 @@ int vm_radix_lookupn(struct vm_radix *, vm_pindex_t, vm_pindex_t, int,
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.