diff options
author | alc <alc@FreeBSD.org> | 2009-07-05 21:40:21 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-07-05 21:40:21 +0000 |
commit | 8c4633ab62af37ee0a885c34f4b92014ab3c42a6 (patch) | |
tree | 1d6b58eb744c93883d2998b4a07d6cb3ac7511d8 /sys/i386 | |
parent | e0b82863b7e5e8ba940d15be6062d1a641b81aaa (diff) | |
download | FreeBSD-src-8c4633ab62af37ee0a885c34f4b92014ab3c42a6.zip FreeBSD-src-8c4633ab62af37ee0a885c34f4b92014ab3c42a6.tar.gz |
PAE adds another level to the i386 page table. This level is a small
4-entry table that must be located within the first 4GB of RAM. This
requirement is met by defining an UMA zone with a custom back-end
allocator function. This revision makes two changes to this back-end
allocator function: (1) It replaces the use of contigmalloc() with the
use of kmem_alloc_contig(). This eliminates "double accounting", i.e.,
accounting by both the UMA zone and malloc tags. (I made the same
change for the same reason to the zones supporting jumbo frames a week
ago.) (2) It passes through the "wait" parameter, i.e., M_WAITOK,
M_ZERO, etc. to kmem_alloc_contig() rather than ignoring it.
pmap_init() calls uma_zalloc() with both M_WAITOK and M_ZERO. At the
moment, this is harmless only because the default behavior of
contigmalloc()/kmem_alloc_contig() is to wait and because pmap_init()
doesn't really depend on the memory being zeroed.
The back-end allocator function in the Xen pmap is dead code. I am
changing it nonetheless because I don't want to leave any "bad examples"
in the source tree for someone to copy at a later date.
Approved by: re (kib)
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/pmap.c | 7 | ||||
-rw-r--r-- | sys/i386/xen/pmap.c | 11 |
2 files changed, 7 insertions, 11 deletions
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index e8926a8..d16632a 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -562,17 +562,14 @@ pmap_page_init(vm_page_t m) } #ifdef PAE - -static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt"); - static void * pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; - return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL, - 1, 0)); + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL, + 0xffffffffULL, 1, 0, VM_CACHE_DEFAULT)); } #endif diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c index 59947e8..ed4300f 100644 --- a/sys/i386/xen/pmap.c +++ b/sys/i386/xen/pmap.c @@ -608,15 +608,14 @@ pmap_page_init(vm_page_t m) } #if defined(PAE) && !defined(XEN) - -static MALLOC_DEFINE(M_PMAPPDPT, "pmap", "pmap pdpt"); - static void * pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) { - *flags = UMA_SLAB_PRIV; - return (contigmalloc(PAGE_SIZE, M_PMAPPDPT, 0, 0x0ULL, 0xffffffffULL, - 1, 0)); + + /* Inform UMA that this allocator uses kernel_map/object. */ + *flags = UMA_SLAB_KERNEL; + return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, 0x0ULL, + 0xffffffffULL, 1, 0, VM_CACHE_DEFAULT)); } #endif |