Page MenuHomeFreeBSD

D19826.id55856.diff
No OneTemporary

D19826.id55856.diff

Index: sys/vm/vm_map.c
===================================================================
--- sys/vm/vm_map.c
+++ sys/vm/vm_map.c
@@ -917,36 +917,44 @@
entry->max_free = MAX(max_left, max_right);
}
-#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \
- y = root->left; \
- if (y != NULL && (test)) { \
- /* Rotate right and make y root. */ \
- root->left = y->right; \
- y->right = root; \
- vm_map_entry_set_max_free(root); \
- root = y; \
- y = root->left; \
- } \
- /* Put root on rlist. */ \
- root->left = rlist; \
- rlist = root; \
- root = y; \
+#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \
+ y = root->left; \
+ if (y != NULL && (test)) { \
+ /* Rotate right and make y root. */ \
+ root->left = y->right; \
+ y->right = root; \
+ if (root->max_free == y->max_free) \
+ vm_map_entry_set_max_free(root); \
+ root = y; \
+ y = root->left; \
+ } \
+ /* Put root on rlist. */ \
+ if (root->max_free == (y != NULL) ? \
+ y->max_free : root->start - root->prev->end) \
+ root->max_free = 0; \
+ root->left = rlist; \
+ rlist = root; \
+ root = y; \
} while (0)
-#define SPLAY_RIGHT_STEP(root, y, llist, test) do { \
- y = root->right; \
- if (y != NULL && (test)) { \
- /* Rotate left and make y root. */ \
- root->right = y->left; \
- y->left = root; \
- vm_map_entry_set_max_free(root); \
- root = y; \
- y = root->right; \
- } \
- /* Put root on llist. */ \
- root->right = llist; \
- llist = root; \
- root = y; \
+#define SPLAY_RIGHT_STEP(root, y, llist, test) do { \
+ y = root->right; \
+ if (y != NULL && (test)) { \
+ /* Rotate left and make y root. */ \
+ root->right = y->left; \
+ y->left = root; \
+ if (root->max_free == y->max_free) \
+ vm_map_entry_set_max_free(root); \
+ root = y; \
+ y = root->right; \
+ } \
+ /* Put root on llist. */ \
+ if (root->max_free == (y != NULL) ? \
+ y->max_free : root->next->start - root->end) \
+ root->max_free = 0; \
+ root->right = llist; \
+ llist = root; \
+ root = y; \
} while (0)
/*
@@ -1019,14 +1027,24 @@
while (llist != NULL) {
y = llist->right;
llist->right = ltree;
- vm_map_entry_set_max_free(llist);
+ if (llist->max_free == 0)
+ vm_map_entry_set_max_free(llist);
+ else
+ llist->max_free = MAX(llist->max_free,
+ ((ltree != NULL) ? ltree->max_free :
+ llist->next->start - llist->end));
ltree = llist;
llist = y;
}
while (rlist != NULL) {
y = rlist->left;
rlist->left = rtree;
- vm_map_entry_set_max_free(rlist);
+ if (rlist->max_free == 0)
+ vm_map_entry_set_max_free(rlist);
+ else
+ rlist->max_free = MAX(rlist->max_free,
+ ((rtree != NULL) ? rtree->max_free :
+ rlist->start - rlist->prev->end));
rtree = rlist;
rlist = y;
}
@@ -1129,13 +1147,9 @@
vm_map_entry_t entry,
enum unlink_merge_type op)
{
- vm_map_entry_t llist, rlist, root, y;
+ vm_map_entry_t llist, prev, next, rlist, root, y;
VM_MAP_ASSERT_LOCKED(map);
- llist = entry->prev;
- rlist = entry->next;
- llist->next = rlist;
- rlist->prev = llist;
root = map->root;
root = vm_map_splay_split(entry->start, 0, root, &llist, &rlist);
KASSERT(root != NULL,
@@ -1174,6 +1188,10 @@
root = NULL;
break;
}
+ prev = (llist == NULL) ? &map->header : llist;
+ next = (rlist == NULL) ? &map->header : rlist;
+ prev->next = next;
+ next->prev = prev;
if (root != NULL)
root = vm_map_splay_merge(root, llist, rlist,
root->left, root->right);

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 2, 7:40 AM (21 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37929596
Default Alt Text
D19826.id55856.diff (3 KB)

Event Timeline