Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_map.c
Context not available. | |||||
static inline void | static inline void | ||||
vm_map_entry_set_max_free(vm_map_entry_t entry) | vm_map_entry_set_max_free(vm_map_entry_t entry) | ||||
{ | { | ||||
vm_map_entry_t child; | vm_map_entry_t child; | ||||
vm_size_t max_left, max_right; | vm_size_t max_left, max_right; | ||||
kib: vm_map_maxfree_left, please honor the symbols namespace. | |||||
child = entry->left; | child = entry->left; | ||||
max_left = (child != NULL) ? child->max_free : | max_left = (child != NULL) ? child->max_free : | ||||
Done Inline ActionsThese functions operate on entries. Why has "entry_" been removed from the function name? alc: These functions operate on entries. Why has "entry_" been removed from the function name? | |||||
Done Inline ActionsBecause 80-character line limits and 8-space tabs make people desperate to avoid long names and nested loops. Neverthless, at the cost of wrapping 2 long lines, this has been changed. dougm: Because 80-character line limits and 8-space tabs make people desperate to avoid long names and… | |||||
entry->start - entry->prev->end; | entry->start - entry->prev->end; | ||||
child = entry->right; | child = entry->right; | ||||
Done Inline ActionsBlank line between functions definitions. kib: Blank line between functions definitions. | |||||
max_right = (child != NULL) ? child->max_free : | max_right = (child != NULL) ? child->max_free : | ||||
Done Inline Actionsnamespace. kib: namespace. | |||||
entry->next->start - entry->end; | entry->next->start - entry->end; | ||||
entry->max_free = MAX(max_left, max_right); | entry->max_free = MAX(max_left, max_right); | ||||
} | } | ||||
Done Inline Actionsvm_size_t, not size_t. alc: vm_size_t, not size_t. | |||||
#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ | #define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ | ||||
y = root->left; \ | y = root->left; \ | ||||
if (y != NULL && (test)) { \ | if (y != NULL && (test)) { \ | ||||
Done Inline ActionsInsert blank line. alc: Insert blank line. | |||||
/* Rotate right and make y root. */ \ | /* Rotate right and make y root. */ \ | ||||
root->left = y->right; \ | root->left = y->right; \ | ||||
y->right = root; \ | y->right = root; \ | ||||
vm_map_entry_set_max_free(root); \ | if (root->max_free == y->max_free) \ | ||||
Done Inline ActionsDitto. alc: Ditto. | |||||
root = y; \ | vm_map_entry_set_max_free(root); \ | ||||
y = root->left; \ | root = y; \ | ||||
} \ | y = root->left; \ | ||||
Done Inline ActionsInsert blank line. alc: Insert blank line. | |||||
/* Put root on rlist. */ \ | } \ | ||||
root->left = rlist; \ | /* Put root on rlist. */ \ | ||||
rlist = root; \ | if (root->max_free == (y != NULL) ? \ | ||||
root = y; \ | y->max_free : y->next->start - y->end) \ | ||||
root->max_free = 0; \ | |||||
root->left = rlist; \ | |||||
rlist = root; \ | |||||
root = y; \ | |||||
} while (0) | } while (0) | ||||
#define SPLAY_RIGHT_STEP(root, y, llist, test) do { \ | #define SPLAY_RIGHT_STEP(root, y, llist, test) do { \ | ||||
y = root->right; \ | y = root->right; \ | ||||
if (y != NULL && (test)) { \ | if (y != NULL && (test)) { \ | ||||
/* Rotate left and make y root. */ \ | /* Rotate left and make y root. */ \ | ||||
root->right = y->left; \ | root->right = y->left; \ | ||||
y->left = root; \ | y->left = root; \ | ||||
vm_map_entry_set_max_free(root); \ | if (root->max_free == y->max_free) \ | ||||
root = y; \ | vm_map_entry_set_max_free(root); \ | ||||
y = root->right; \ | root = y; \ | ||||
} \ | y = root->right; \ | ||||
/* Put root on llist. */ \ | } \ | ||||
root->right = llist; \ | /* Put root on llist. */ \ | ||||
llist = root; \ | if (root->max_free == (y != NULL) ? \ | ||||
root = y; \ | y->max_free : y->start - y->prev->end) \ | ||||
root->max_free = 0; \ | |||||
root->right = llist; \ | |||||
llist = root; \ | |||||
root = y; \ | |||||
} while (0) | } while (0) | ||||
/* | /* | ||||
* Walk down the tree until we find addr or a NULL pointer where addr would go, | * Walk down the tree until we find addr or a NULL pointer where addr would go, | ||||
* breaking off left and right subtrees of nodes less than, or greater than | * breaking off left and right subtrees of nodes less than, or greater than | ||||
* addr. Treat pointers to nodes with max_free < length as NULL pointers. | * addr. Treat pointers to nodes with max_free < length as NULL pointers. | ||||
* llist and rlist are the two sides in reverse order (bottom-up), with llist | * llist and rlist are the two sides in reverse order (bottom-up), with llist | ||||
* linked by the right pointer and rlist linked by the left pointer in the | * linked by the right pointer and rlist linked by the left pointer in the | ||||
Show All 14 Lines | |||||
vm_map_entry_t llist, vm_map_entry_t rlist, | vm_map_entry_t llist, vm_map_entry_t rlist, | ||||
vm_map_entry_t ltree, vm_map_entry_t rtree) | vm_map_entry_t ltree, vm_map_entry_t rtree) | ||||
{ | { | ||||
vm_map_entry_t y; | vm_map_entry_t y; | ||||
while (llist != NULL) { | while (llist != NULL) { | ||||
y = llist->right; | y = llist->right; | ||||
llist->right = ltree; | llist->right = ltree; | ||||
vm_map_entry_set_max_free(llist); | if (llist->max_free < ((ltree != NULL) ? ltree->max_free : | ||||
llist->next->start - llist->end)) | |||||
vm_map_entry_set_max_free(llist); | |||||
ltree = llist; | ltree = llist; | ||||
llist = y; | llist = y; | ||||
} | } | ||||
while (rlist != NULL) { | while (rlist != NULL) { | ||||
y = rlist->left; | y = rlist->left; | ||||
rlist->left = rtree; | rlist->left = rtree; | ||||
vm_map_entry_set_max_free(rlist); | if (rlist->max_free < ((rtree != NULL) ? rtree->max_free : | ||||
rlist->start - rlist->prev->end)) | |||||
vm_map_entry_set_max_free(rlist); | |||||
rtree = rlist; | rtree = rlist; | ||||
rlist = y; | rlist = y; | ||||
} | } | ||||
/* | /* | ||||
* Final assembly: add ltree and rtree as subtrees of root. | * Final assembly: add ltree and rtree as subtrees of root. | ||||
*/ | */ | ||||
root->left = ltree; | root->left = ltree; | ||||
root->right = rtree; | root->right = rtree; | ||||
vm_map_entry_set_max_free(root); | vm_map_entry_set_max_free(root); | ||||
return (root); | return (root); | ||||
} | } | ||||
/* | /* | ||||
Context not available. | |||||
Done Inline ActionsIncorrect indentation. alc: Incorrect indentation. | |||||
Done Inline ActionsUnnecessary parentheses. alc: Unnecessary parentheses. | |||||
Done Inline ActionsWith this change, I would have expected the removal of entry_ from the function's name. In general, there is increasing inconsistency in the use of vm_map_entry_ versus vm_map_. alc: With this change, I would have expected the removal of entry_ from the function's name. In… |
vm_map_maxfree_left, please honor the symbols namespace.