Date: Wed, 8 Aug 2018 16:08:39 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337459 - in head/sys/riscv: include riscv Message-ID: <201808081608.w78G8dMp055917@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: br Date: Wed Aug 8 16:08:38 2018 New Revision: 337459 URL: https://svnweb.freebsd.org/changeset/base/337459 Log: Implement uma_small_alloc(), uma_small_free(). Reviewed by: markj Obtained from: arm64 Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16628 Modified: head/sys/riscv/include/vmparam.h head/sys/riscv/riscv/uma_machdep.c Modified: head/sys/riscv/include/vmparam.h ============================================================================== --- head/sys/riscv/include/vmparam.h Wed Aug 8 15:25:01 2018 (r337458) +++ head/sys/riscv/include/vmparam.h Wed Aug 8 16:08:38 2018 (r337459) @@ -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; Modified: head/sys/riscv/riscv/uma_machdep.c ============================================================================== --- head/sys/riscv/riscv/uma_machdep.c Wed Aug 8 15:25:01 2018 (r337458) +++ head/sys/riscv/riscv/uma_machdep.c Wed Aug 8 16:08:38 2018 (r337459) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808081608.w78G8dMp055917>