Add a vm.blacklist tunable which can hold a space or comma seperated list

of physical addresses.  The pages containing these physical addresses will
not be added to the free list and thus will effectively be ignored by the
VM system.  This is mostly useful for the case when one knows of specific
physical addresses that have bit errors (such as from a memtest run) so
that one can blacklist the bad pages while waiting for the new sticks of
RAM to arrive.  The physical addresses of any ignored pages are listed in
the message buffer as well.
This commit is contained in:
John Baldwin 2005-04-15 21:45:02 +00:00
parent 514ff253c2
commit 3c3edcb445

View File

@ -105,10 +105,39 @@ vm_pageq_enqueue(int queue, vm_page_t m)
vm_page_t
vm_pageq_add_new_page(vm_paddr_t pa)
{
vm_paddr_t bad;
vm_page_t m;
char *cp, *list, *pos;
GIANT_REQUIRED;
/*
* See if a physical address in this page has been listed
* in the blacklist tunable. Entries in the tunable are
* separated by spaces or commas. If an invalid integer is
* encountered then the rest of the string is skipped.
*/
if (testenv("vm.blacklist")) {
list = getenv("vm.blacklist");
for (pos = list; *pos != '\0'; pos = cp) {
bad = strtoq(pos, &cp, 0);
if (*cp != '\0') {
if (*cp == ' ' || *cp == ',') {
cp++;
if (cp == pos)
continue;
} else
break;
}
if (pa == trunc_page(bad)) {
printf("Skipping page with pa 0x%x\n", pa);
freeenv(list);
return (NULL);
}
}
freeenv(list);
}
++cnt.v_page_count;
m = PHYS_TO_VM_PAGE(pa);
m->phys_addr = pa;