Avoid using the prev field of vm_map_entry_t in two functions that
iterate over consecutive vm_map entries, and that can easily just 'remember' the prev value instead of looking it up. Approved by: kib (mentor) Differential Revision: https://reviews.freebsd.org/D20628
This commit is contained in:
parent
c80038a0a7
commit
771315283b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=349030
@ -734,18 +734,17 @@ SYSCTL_INT(_debug, OID_AUTO, vmmap_check, CTLFLAG_RWTUN,
|
|||||||
static void
|
static void
|
||||||
_vm_map_assert_consistent(vm_map_t map)
|
_vm_map_assert_consistent(vm_map_t map)
|
||||||
{
|
{
|
||||||
vm_map_entry_t entry;
|
vm_map_entry_t child, entry, prev;
|
||||||
vm_map_entry_t child;
|
|
||||||
vm_size_t max_left, max_right;
|
vm_size_t max_left, max_right;
|
||||||
|
|
||||||
if (!enable_vmmap_check)
|
if (!enable_vmmap_check)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (entry = map->header.next; entry != &map->header;
|
for (prev = &map->header; (entry = prev->next) != &map->header;
|
||||||
entry = entry->next) {
|
prev = entry) {
|
||||||
KASSERT(entry->prev->end <= entry->start,
|
KASSERT(prev->end <= entry->start,
|
||||||
("map %p prev->end = %jx, start = %jx", map,
|
("map %p prev->end = %jx, start = %jx", map,
|
||||||
(uintmax_t)entry->prev->end, (uintmax_t)entry->start));
|
(uintmax_t)prev->end, (uintmax_t)entry->start));
|
||||||
KASSERT(entry->start < entry->end,
|
KASSERT(entry->start < entry->end,
|
||||||
("map %p start = %jx, end = %jx", map,
|
("map %p start = %jx, end = %jx", map,
|
||||||
(uintmax_t)entry->start, (uintmax_t)entry->end));
|
(uintmax_t)entry->start, (uintmax_t)entry->end));
|
||||||
@ -762,7 +761,7 @@ _vm_map_assert_consistent(vm_map_t map)
|
|||||||
(uintmax_t)entry->start, (uintmax_t)entry->right->start));
|
(uintmax_t)entry->start, (uintmax_t)entry->right->start));
|
||||||
child = entry->left;
|
child = entry->left;
|
||||||
max_left = (child != NULL) ? child->max_free :
|
max_left = (child != NULL) ? child->max_free :
|
||||||
entry->start - entry->prev->end;
|
entry->start - prev->end;
|
||||||
child = entry->right;
|
child = entry->right;
|
||||||
max_right = (child != NULL) ? child->max_free :
|
max_right = (child != NULL) ? child->max_free :
|
||||||
entry->next->start - entry->end;
|
entry->next->start - entry->end;
|
||||||
@ -4811,15 +4810,15 @@ vm_map_pmap_KBI(vm_map_t map)
|
|||||||
static void
|
static void
|
||||||
vm_map_print(vm_map_t map)
|
vm_map_print(vm_map_t map)
|
||||||
{
|
{
|
||||||
vm_map_entry_t entry;
|
vm_map_entry_t entry, prev;
|
||||||
|
|
||||||
db_iprintf("Task map %p: pmap=%p, nentries=%d, version=%u\n",
|
db_iprintf("Task map %p: pmap=%p, nentries=%d, version=%u\n",
|
||||||
(void *)map,
|
(void *)map,
|
||||||
(void *)map->pmap, map->nentries, map->timestamp);
|
(void *)map->pmap, map->nentries, map->timestamp);
|
||||||
|
|
||||||
db_indent += 2;
|
db_indent += 2;
|
||||||
for (entry = map->header.next; entry != &map->header;
|
for (prev = &map->header; (entry = prev->next) != &map->header;
|
||||||
entry = entry->next) {
|
prev = entry) {
|
||||||
db_iprintf("map entry %p: start=%p, end=%p, eflags=%#x, \n",
|
db_iprintf("map entry %p: start=%p, end=%p, eflags=%#x, \n",
|
||||||
(void *)entry, (void *)entry->start, (void *)entry->end,
|
(void *)entry, (void *)entry->start, (void *)entry->end,
|
||||||
entry->eflags);
|
entry->eflags);
|
||||||
@ -4830,7 +4829,8 @@ vm_map_print(vm_map_t map)
|
|||||||
db_iprintf(" prot=%x/%x/%s",
|
db_iprintf(" prot=%x/%x/%s",
|
||||||
entry->protection,
|
entry->protection,
|
||||||
entry->max_protection,
|
entry->max_protection,
|
||||||
inheritance_name[(int)(unsigned char)entry->inheritance]);
|
inheritance_name[(int)(unsigned char)
|
||||||
|
entry->inheritance]);
|
||||||
if (entry->wired_count != 0)
|
if (entry->wired_count != 0)
|
||||||
db_printf(", wired");
|
db_printf(", wired");
|
||||||
}
|
}
|
||||||
@ -4838,9 +4838,9 @@ vm_map_print(vm_map_t map)
|
|||||||
db_printf(", share=%p, offset=0x%jx\n",
|
db_printf(", share=%p, offset=0x%jx\n",
|
||||||
(void *)entry->object.sub_map,
|
(void *)entry->object.sub_map,
|
||||||
(uintmax_t)entry->offset);
|
(uintmax_t)entry->offset);
|
||||||
if ((entry->prev == &map->header) ||
|
if (prev == &map->header ||
|
||||||
(entry->prev->object.sub_map !=
|
prev->object.sub_map !=
|
||||||
entry->object.sub_map)) {
|
entry->object.sub_map) {
|
||||||
db_indent += 2;
|
db_indent += 2;
|
||||||
vm_map_print((vm_map_t)entry->object.sub_map);
|
vm_map_print((vm_map_t)entry->object.sub_map);
|
||||||
db_indent -= 2;
|
db_indent -= 2;
|
||||||
@ -4860,9 +4860,9 @@ vm_map_print(vm_map_t map)
|
|||||||
(entry->eflags & MAP_ENTRY_NEEDS_COPY) ? "needed" : "done");
|
(entry->eflags & MAP_ENTRY_NEEDS_COPY) ? "needed" : "done");
|
||||||
db_printf("\n");
|
db_printf("\n");
|
||||||
|
|
||||||
if ((entry->prev == &map->header) ||
|
if (prev == &map->header ||
|
||||||
(entry->prev->object.vm_object !=
|
prev->object.vm_object !=
|
||||||
entry->object.vm_object)) {
|
entry->object.vm_object) {
|
||||||
db_indent += 2;
|
db_indent += 2;
|
||||||
vm_object_print((db_expr_t)(intptr_t)
|
vm_object_print((db_expr_t)(intptr_t)
|
||||||
entry->object.vm_object,
|
entry->object.vm_object,
|
||||||
|
Loading…
Reference in New Issue
Block a user