diff options
author | alc <alc@FreeBSD.org> | 2007-06-16 04:57:06 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2007-06-16 04:57:06 +0000 |
commit | a8415c5a0d7d39fe501a93e2f31b2532cf6dfd91 (patch) | |
tree | d4adea7a0cd4062bbcbfbb6bc1a5a30eecf59d97 /sys/vm/vm_zeroidle.c | |
parent | 98cd3abe8b02f0ae3d389eb9e6ecbf4bf39032f6 (diff) | |
download | FreeBSD-src-a8415c5a0d7d39fe501a93e2f31b2532cf6dfd91.zip FreeBSD-src-a8415c5a0d7d39fe501a93e2f31b2532cf6dfd91.tar.gz |
Enable the new physical memory allocator.
This allocator uses a binary buddy system with a twist. First and
foremost, this allocator is required to support the implementation of
superpages. As a side effect, it enables a more robust implementation
of contigmalloc(9). Moreover, this reimplementation of
contigmalloc(9) eliminates the acquisition of Giant by
contigmalloc(..., M_NOWAIT, ...).
The twist is that this allocator tries to reduce the number of TLB
misses incurred by accesses through a direct map to small, UMA-managed
objects and page table pages. Roughly speaking, the physical pages
that are allocated for such purposes are clustered together in the
physical address space. The performance benefits vary. In the most
extreme case, a uniprocessor kernel running on an Opteron, I measured
an 18% reduction in system time during a buildworld.
This allocator does not implement page coloring. The reason is that
superpages have much the same effect. The contiguous physical memory
allocation necessary for a superpage is inherently colored.
Finally, the one caveat is that this allocator does not effectively
support prezeroed pages. I hope this is temporary. On i386, this is
a slight pessimization. However, on amd64, the beneficial effects of
the direct-map optimization outweigh the ill effects. I speculate
that this is true in general of machines with a direct map.
Approved by: re
Diffstat (limited to 'sys/vm/vm_zeroidle.c')
-rw-r--r-- | sys/vm/vm_zeroidle.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/sys/vm/vm_zeroidle.c b/sys/vm/vm_zeroidle.c index b21d01f..1cba318 100644 --- a/sys/vm/vm_zeroidle.c +++ b/sys/vm/vm_zeroidle.c @@ -51,12 +51,9 @@ __FBSDID("$FreeBSD$"); #include <vm/vm.h> #include <vm/vm_page.h> +#include <vm/vm_phys.h> -static int cnt_prezero; -SYSCTL_INT(_vm_stats_misc, OID_AUTO, cnt_prezero, CTLFLAG_RD, - &cnt_prezero, 0, ""); - -static int idlezero_enable_default = 1; +static int idlezero_enable_default = 0; TUNABLE_INT("vm.idlezero_enable", &idlezero_enable_default); /* Defer setting the enable flag until the kthread is running. */ static int idlezero_enable = 0; @@ -100,25 +97,13 @@ vm_page_zero_check(void) static void vm_page_zero_idle(void) { - static int free_rover; - vm_page_t m; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); zero_state = 0; - m = vm_pageq_find(PQ_FREE, free_rover, FALSE); - if (m != NULL && (m->flags & PG_ZERO) == 0) { - vm_pageq_remove_nowakeup(m); - mtx_unlock(&vm_page_queue_free_mtx); - pmap_zero_page_idle(m); - mtx_lock(&vm_page_queue_free_mtx); - m->flags |= PG_ZERO; - vm_pageq_enqueue(PQ_FREE + m->pc, m); - ++vm_page_zero_count; - ++cnt_prezero; + if (vm_phys_zero_pages_idle()) { if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count)) zero_state = 1; } - free_rover = (free_rover + PQ_PRIME2) & PQ_COLORMASK; } /* Called by vm_page_free to hint that a new page is available. */ |