mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-01 08:27:59 +00:00
Implement uma_small_alloc(), uma_small_free().
Reviewed by: markj Obtained from: arm64 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16628
This commit is contained in:
parent
702da35288
commit
6371d0bd64
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337459
@ -223,10 +223,7 @@
|
||||
#define VM_INITIAL_PAGEIN 16
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RISCVTODO
|
||||
* #define UMA_MD_SMALL_ALLOC
|
||||
*/
|
||||
#define UMA_MD_SMALL_ALLOC
|
||||
|
||||
#ifndef LOCORE
|
||||
extern vm_paddr_t dmap_phys_base;
|
||||
|
@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_page.h>
|
||||
#include <vm/vm_pageout.h>
|
||||
@ -44,13 +45,39 @@ void *
|
||||
uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags,
|
||||
int wait)
|
||||
{
|
||||
vm_page_t m;
|
||||
vm_paddr_t pa;
|
||||
void *va;
|
||||
|
||||
panic("uma_small_alloc");
|
||||
*flags = UMA_SLAB_PRIV;
|
||||
m = vm_page_alloc_domain(NULL, 0, domain,
|
||||
malloc2vm_flags(wait) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED);
|
||||
if (m == NULL)
|
||||
return (NULL);
|
||||
pa = m->phys_addr;
|
||||
#if 0
|
||||
/* RISCVTODO: minidump */
|
||||
if ((wait & M_NODUMP) == 0)
|
||||
dump_add_page(pa);
|
||||
#endif
|
||||
va = (void *)PHYS_TO_DMAP(pa);
|
||||
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
|
||||
bzero(va, PAGE_SIZE);
|
||||
return (va);
|
||||
}
|
||||
|
||||
void
|
||||
uma_small_free(void *mem, vm_size_t size, u_int8_t flags)
|
||||
{
|
||||
vm_page_t m;
|
||||
vm_paddr_t pa;
|
||||
|
||||
panic("uma_small_free");
|
||||
pa = DMAP_TO_PHYS((vm_offset_t)mem);
|
||||
#if 0
|
||||
/* RISCVTODO: minidump */
|
||||
dump_drop_page(pa);
|
||||
#endif
|
||||
m = PHYS_TO_VM_PAGE(pa);
|
||||
vm_page_unwire_noq(m);
|
||||
vm_page_free(m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user