diff options
author | cognet <cognet@FreeBSD.org> | 2005-06-23 11:37:41 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2005-06-23 11:37:41 +0000 |
commit | 39c5af124eeab5652dcbcec8d0288dfc5c89bcfb (patch) | |
tree | 91795341ebe8301d85a175093d96819cdb97292e /sys/arm | |
parent | 3c6267e11deff4f879133acb2c3fd807bc107d88 (diff) | |
download | FreeBSD-src-39c5af124eeab5652dcbcec8d0288dfc5c89bcfb.zip FreeBSD-src-39c5af124eeab5652dcbcec8d0288dfc5c89bcfb.tar.gz |
Don't abuse UMA_SLAB_KMEM.
Approved by: re (blanket)
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/pmap.c | 3 | ||||
-rw-r--r-- | sys/arm/arm/vm_machdep.c | 10 |
2 files changed, 4 insertions, 9 deletions
diff --git a/sys/arm/arm/pmap.c b/sys/arm/arm/pmap.c index a2ef3d6..8083cea 100644 --- a/sys/arm/arm/pmap.c +++ b/sys/arm/arm/pmap.c @@ -2410,6 +2410,7 @@ pmap_alloc_specials(vm_offset_t *availp, int pages, vm_offset_t *vap, #ifdef ARM_USE_SMALL_ALLOC extern struct mtx smallalloc_mtx; extern vm_offset_t alloc_curaddr; +extern vm_offset_t alloc_firstaddr; #endif void @@ -2565,7 +2566,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm_offset_t lastaddr, struct pv_addr *l1pt kernel_vm_end = pmap_curmaxkvaddr; #ifdef ARM_USE_SMALL_ALLOC mtx_init(&smallalloc_mtx, "Small alloc page list", NULL, MTX_DEF); - alloc_curaddr = lastaddr; + alloc_firstaddr = alloc_curaddr = lastaddr; #endif } diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 8230c3c..6c0760e 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -380,6 +380,7 @@ struct mtx smallalloc_mtx; MALLOC_DEFINE(M_VMSMALLALLOC, "VM Small alloc", "VM Small alloc data"); vm_offset_t alloc_curaddr; +vm_offset_t alloc_firstaddr; extern int doverbose; @@ -463,15 +464,12 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) /* No more free pages, need to alloc more. */ mtx_unlock(&smallalloc_mtx); if (!(wait & M_WAITOK)) { - *flags = UMA_SLAB_KMEM; ret = (void *)kmem_malloc(kmem_map, bytes, wait); return (ret); } /* Try to alloc 1MB of contiguous memory. */ ret = arm_uma_do_alloc(&sp, bytes, zone == l2zone ? SECTION_PT : SECTION_CACHE); - if (!sp) - *flags = UMA_SLAB_KMEM; mtx_lock(&smallalloc_mtx); if (sp) { for (int i = 0; i < (0x100000 / PAGE_SIZE) - 1; @@ -490,10 +488,6 @@ uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) TAILQ_REMOVE(head, sp, pg_list); TAILQ_INSERT_HEAD(&free_pgdesc, sp, pg_list); ret = sp->addr; - if (ret == NULL) - panic("NULL"); - if (ret < (void *)0xa0000000) - panic("BLA %p", ret); } mtx_unlock(&smallalloc_mtx); if ((wait & M_ZERO)) @@ -507,7 +501,7 @@ uma_small_free(void *mem, int size, u_int8_t flags) pd_entry_t *pd; pt_entry_t *pt; - if (flags & UMA_SLAB_KMEM) + if (mem < (void *)alloc_firstaddr) kmem_free(kmem_map, (vm_offset_t)mem, size); else { struct arm_small_page *sp; |