From 9f701172635d755151f24e15e78c357d3378bd09 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 29 Mar 2019 16:53:46 +0000 Subject: Eliminate adj_free field from vm_map_entry. Drop the adj_free field from vm_map_entry_t. Refine the max_free field so that p->max_free is the size of the largest gap with one endpoint in the subtree rooted at p. Change vm_map_findspace so that, first, the address-based splay is restricted to tree nodes with large-enough max_free value, to avoid searching for the right starting point in a subtree where all the gaps are too small. Second, when the address search leads to a tree search for the first large-enough gap, that gap is the subject of a splay-search that brings the gap to the top of the tree, so that an immediate insertion will take constant time. Break up the splay code into separate components, one for searching and breaking up the tree and another for reassembling it. Use these components, and not splay itself, for linking and unlinking. Drop the after-where parameter to link, as it is computed as a side-effect of the splay search. Submitted by: Doug Moore Reviewed by: markj Tested by: pho MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D17794 --- sys/vm/vm_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/vm/vm_kern.c') diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 05b3669449eb..ac87a40a3b81 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -641,7 +641,8 @@ kmap_alloc_wait(vm_map_t map, vm_size_t size) * to lock out sleepers/wakers. */ vm_map_lock(map); - if (vm_map_findspace(map, vm_map_min(map), size, &addr) == 0) + addr = vm_map_findspace(map, vm_map_min(map), size); + if (addr + size <= vm_map_max(map)) break; /* no space now; see if we can ever get space */ if (vm_map_max(map) - vm_map_min(map) < size) { -- cgit v1.2.3