1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

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)
This commit is contained in:
Alan Cox 2009-07-05 21:40:21 +00:00
parent 24d3677b9d
commit 0e18ab26d0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195385
2 changed files with 7 additions and 11 deletions

View File

@ -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

View File

@ -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