diff options
author | alc <alc@FreeBSD.org> | 2004-08-13 08:06:34 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2004-08-13 08:06:34 +0000 |
commit | 482b6818afd4db4c0be3027d637df4d534bc9eee (patch) | |
tree | 5e8beccffc1dea81c083b35c99a888b52aa69c82 /sys/dev/ata/ata-dma.c | |
parent | d2ff11056b54e4dbd55e3694dae3e033afe5d344 (diff) | |
download | FreeBSD-src-482b6818afd4db4c0be3027d637df4d534bc9eee.zip FreeBSD-src-482b6818afd4db4c0be3027d637df4d534bc9eee.tar.gz |
Replace the linear search in vm_map_findspace() with an O(log n)
algorithm built into the map entry splay tree. This replaces the
first_free hint in struct vm_map with two fields in vm_map_entry:
adj_free, the amount of free space following a map entry, and
max_free, the maximum amount of free space in the entry's subtree.
These fields make it possible to find a first-fit free region of a
given size in one pass down the tree, so O(log n) amortized using
splay trees.
This significantly reduces the overhead in vm_map_findspace() for
applications that mmap() many hundreds or thousands of regions, and
has a negligible slowdown (0.1%) on buildworld. See, for example, the
discussion of a micro-benchmark titled "Some mmap observations
compared to Linux 2.6/OpenBSD" on -hackers in late October 2003.
OpenBSD adopted this approach in March 2002, and NetBSD added it in
November 2003, both with Red-Black trees.
Submitted by: Mark W. Krentel
Diffstat (limited to 'sys/dev/ata/ata-dma.c')
0 files changed, 0 insertions, 0 deletions