mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-23 11:18:54 +00:00
Micro-optimize the control flow in a few places. Eliminate a panic call
that could never be reached in vm_radix_insert(). (If the pointer being checked by the panic call were ever NULL, the immmediately preceding loop would have already crashed on a NULL pointer dereference.) Reviewed by: attilio (an earlier version) Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
8feedf2993
commit
652615dcb7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248684
@ -310,7 +310,9 @@ vm_radix_reclaim_allnodes_int(struct vm_radix_node *rnode)
|
||||
{
|
||||
int slot;
|
||||
|
||||
for (slot = 0; slot < VM_RADIX_COUNT && rnode->rn_count != 0; slot++) {
|
||||
KASSERT(rnode->rn_count <= VM_RADIX_COUNT,
|
||||
("vm_radix_reclaim_allnodes_int: bad count in rnode %p", rnode));
|
||||
for (slot = 0; rnode->rn_count != 0; slot++) {
|
||||
if (rnode->rn_child[slot] == NULL)
|
||||
continue;
|
||||
if (vm_radix_node_page(rnode->rn_child[slot]) == NULL)
|
||||
@ -414,9 +416,7 @@ vm_radix_insert(struct vm_radix *rtree, vm_page_t page)
|
||||
vm_radix_addpage(rnode, index, 0, page);
|
||||
return;
|
||||
}
|
||||
while (rnode != NULL) {
|
||||
if (vm_radix_keybarr(rnode, index))
|
||||
break;
|
||||
do {
|
||||
slot = vm_radix_slot(index, rnode->rn_clev);
|
||||
m = vm_radix_node_page(rnode->rn_child[slot]);
|
||||
if (m != NULL) {
|
||||
@ -437,9 +437,7 @@ vm_radix_insert(struct vm_radix *rtree, vm_page_t page)
|
||||
return;
|
||||
}
|
||||
rnode = rnode->rn_child[slot];
|
||||
}
|
||||
if (rnode == NULL)
|
||||
panic("%s: path traversal ended unexpectedly", __func__);
|
||||
} while (!vm_radix_keybarr(rnode, index));
|
||||
|
||||
/*
|
||||
* Scan the trie from the top and find the parent to insert
|
||||
@ -748,8 +746,8 @@ vm_radix_reclaim_allnodes(struct vm_radix *rtree)
|
||||
root = vm_radix_getroot(rtree);
|
||||
if (root == NULL)
|
||||
return;
|
||||
vm_radix_reclaim_allnodes_int(root);
|
||||
vm_radix_setroot(rtree, NULL);
|
||||
vm_radix_reclaim_allnodes_int(root);
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
|
Loading…
Reference in New Issue
Block a user