FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <sys/callout.h>
#include <sys/hash.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/smp.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/vmem.h>
#include <sys/vmmeter.h>
#include "opt_vm.h"
#include <vm/uma.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_object.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/vm_phys.h>
#include <vm/vm_pagequeue.h>
#include <vm/uma_int.h>
Go to the source code of this file.
Data Structures | |
struct | qcache |
struct | vmem_btag |
struct | vmem |
Macros | |
#define | VMEM_OPTORDER 5 |
#define | VMEM_OPTVALUE (1 << VMEM_OPTORDER) |
#define | VMEM_MAXORDER (VMEM_OPTVALUE - 1 + sizeof(vmem_size_t) * NBBY - VMEM_OPTORDER) |
#define | VMEM_HASHSIZE_MIN 16 |
#define | VMEM_HASHSIZE_MAX 131072 |
#define | VMEM_QCACHE_IDX_MAX 16 |
#define | VMEM_FITMASK (M_BESTFIT | M_FIRSTFIT | M_NEXTFIT) |
#define | VMEM_FLAGS |
#define | BT_FLAGS (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_NOVM) |
#define | QC_NAME_MAX 16 |
#define | QC_POOL_TO_QCACHE(pool) ((qcache_t *)(pool->pr_qcache)) |
#define | VMEM_NAME_MAX 16 |
#define | bt_hashlist bt_u.u_hashlist |
#define | bt_freelist bt_u.u_freelist |
#define | BT_TYPE_SPAN 1 /* Allocated from importfn */ |
#define | BT_TYPE_SPAN_STATIC 2 /* vmem_add() or create. */ |
#define | BT_TYPE_FREE 3 /* Available space. */ |
#define | BT_TYPE_BUSY 4 /* Used space. */ |
#define | BT_TYPE_CURSOR 5 /* Cursor for nextfit allocations. */ |
#define | BT_ISSPAN_P(bt) ((bt)->bt_type <= BT_TYPE_SPAN_STATIC) |
#define | BT_END(bt) ((bt)->bt_start + (bt)->bt_size - 1) |
#define | VMEM_CONDVAR_INIT(vm, wchan) cv_init(&vm->vm_cv, wchan) |
#define | VMEM_CONDVAR_DESTROY(vm) cv_destroy(&vm->vm_cv) |
#define | VMEM_CONDVAR_WAIT(vm) cv_wait(&vm->vm_cv, &vm->vm_lock) |
#define | VMEM_CONDVAR_BROADCAST(vm) cv_broadcast(&vm->vm_cv) |
#define | VMEM_LOCK(vm) mtx_lock(&vm->vm_lock) |
#define | VMEM_TRYLOCK(vm) mtx_trylock(&vm->vm_lock) |
#define | VMEM_UNLOCK(vm) mtx_unlock(&vm->vm_lock) |
#define | VMEM_LOCK_INIT(vm, name) mtx_init(&vm->vm_lock, (name), NULL, MTX_DEF) |
#define | VMEM_LOCK_DESTROY(vm) mtx_destroy(&vm->vm_lock) |
#define | VMEM_ASSERT_LOCKED(vm) mtx_assert(&vm->vm_lock, MA_OWNED); |
#define | VMEM_ALIGNUP(addr, align) (-(-(addr) & -(align))) |
#define | VMEM_CROSS_P(addr1, addr2, boundary) ((((addr1) ^ (addr2)) & -(boundary)) != 0) |
#define | ORDER2SIZE(order) |
#define | SIZE2ORDER(size) |
#define | BT_MAXALLOC 4 |
#define | BT_MAXFREE (BT_MAXALLOC * 8) |
#define | vmem_printf printf |
Typedefs | |
typedef struct vmem_btag | bt_t |
typedef struct qcache | qcache_t |
Functions | |
__FBSDID ("$FreeBSD$") | |
MALLOC_DEFINE (M_VMEM, "vmem", "vmem internal structures") | |
TAILQ_HEAD (vmem_seglist, vmem_btag) | |
LIST_HEAD (vmem_freelist, vmem_btag) | |
LIST_HEAD (vmem_hashlist, vmem_btag) | |
static | LIST_HEAD (vmem) |
static bool | bt_isfree (bt_t *bt) |
static __noinline int | _bt_fill (vmem_t *vm, int flags) |
static int | bt_fill (vmem_t *vm, int flags) |
static bt_t * | bt_alloc (vmem_t *vm) |
static void | bt_freetrim (vmem_t *vm, int freelimit) |
static void | bt_free (vmem_t *vm, bt_t *bt) |
static void | bt_save (vmem_t *vm) |
static void | bt_restore (vmem_t *vm) |
static struct vmem_freelist * | bt_freehead_tofree (vmem_t *vm, vmem_size_t size) |
static struct vmem_freelist * | bt_freehead_toalloc (vmem_t *vm, vmem_size_t size, int strat) |
static struct vmem_hashlist * | bt_hashhead (vmem_t *vm, vmem_addr_t addr) |
static bt_t * | bt_lookupbusy (vmem_t *vm, vmem_addr_t addr) |
static void | bt_rembusy (vmem_t *vm, bt_t *bt) |
static void | bt_insbusy (vmem_t *vm, bt_t *bt) |
static void | bt_remseg (vmem_t *vm, bt_t *bt) |
static void | bt_insseg (vmem_t *vm, bt_t *bt, bt_t *prev) |
static void | bt_insseg_tail (vmem_t *vm, bt_t *bt) |
static void | bt_remfree (vmem_t *vm __unused, bt_t *bt) |
static void | bt_insfree (vmem_t *vm, bt_t *bt) |
static int | qc_import (void *arg, void **store, int cnt, int domain, int flags) |
static void | qc_release (void *arg, void **store, int cnt) |
static void | qc_init (vmem_t *vm, vmem_size_t qcache_max) |
static void | qc_destroy (vmem_t *vm) |
static void | qc_drain (vmem_t *vm) |
static void * | vmem_bt_alloc (uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, int wait) |
void | vmem_startup (void) |
static int | vmem_rehash (vmem_t *vm, vmem_size_t newhashsize) |
static void | vmem_periodic_kick (void *dummy) |
static void | vmem_periodic (void *unused, int pending) |
static void | vmem_start_callout (void *unused) |
SYSINIT (vfs, SI_SUB_CONFIGURE, SI_ORDER_ANY, vmem_start_callout, NULL) | |
static void | vmem_add1 (vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int type) |
static void | vmem_destroy1 (vmem_t *vm) |
static int | vmem_import (vmem_t *vm, vmem_size_t size, vmem_size_t align, int flags) |
static int | vmem_fit (const bt_t *bt, vmem_size_t size, vmem_size_t align, vmem_size_t phase, vmem_size_t nocross, vmem_addr_t minaddr, vmem_addr_t maxaddr, vmem_addr_t *addrp) |
static void | vmem_clip (vmem_t *vm, bt_t *bt, vmem_addr_t start, vmem_size_t size) |
static int | vmem_try_fetch (vmem_t *vm, const vmem_size_t size, vmem_size_t align, int flags) |
static int | vmem_try_release (vmem_t *vm, struct vmem_btag *bt, const bool remfree) |
static int | vmem_xalloc_nextfit (vmem_t *vm, const vmem_size_t size, vmem_size_t align, const vmem_size_t phase, const vmem_size_t nocross, int flags, vmem_addr_t *addrp) |
void | vmem_set_import (vmem_t *vm, vmem_import_t *importfn, vmem_release_t *releasefn, void *arg, vmem_size_t import_quantum) |
void | vmem_set_limit (vmem_t *vm, vmem_size_t limit) |
void | vmem_set_reclaim (vmem_t *vm, vmem_reclaim_t *reclaimfn) |
vmem_t * | vmem_init (vmem_t *vm, const char *name, vmem_addr_t base, vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int flags) |
vmem_t * | vmem_create (const char *name, vmem_addr_t base, vmem_size_t size, vmem_size_t quantum, vmem_size_t qcache_max, int flags) |
void | vmem_destroy (vmem_t *vm) |
vmem_size_t | vmem_roundup_size (vmem_t *vm, vmem_size_t size) |
int | vmem_alloc (vmem_t *vm, vmem_size_t size, int flags, vmem_addr_t *addrp) |
int | vmem_xalloc (vmem_t *vm, const vmem_size_t size0, vmem_size_t align, const vmem_size_t phase, const vmem_size_t nocross, const vmem_addr_t minaddr, const vmem_addr_t maxaddr, int flags, vmem_addr_t *addrp) |
void | vmem_free (vmem_t *vm, vmem_addr_t addr, vmem_size_t size) |
void | vmem_xfree (vmem_t *vm, vmem_addr_t addr, vmem_size_t size __unused) |
int | vmem_add (vmem_t *vm, vmem_addr_t addr, vmem_size_t size, int flags) |
vmem_size_t | vmem_size (vmem_t *vm, int typemask) |
Variables | |
static struct callout | vmem_periodic_ch |
static int | vmem_periodic_interval |
static struct task | vmem_periodic_wk |
static struct mtx_padalign __exclusive_cache_line | vmem_list_lock |
static struct mtx_padalign __exclusive_cache_line | vmem_bt_lock |
Definition at line 181 of file subr_vmem.c.
#define BT_FLAGS (M_NOWAIT | M_WAITOK | M_USE_RESERVE | M_NOVM) |
Definition at line 95 of file subr_vmem.c.
#define bt_freelist bt_u.u_freelist |
Definition at line 129 of file subr_vmem.c.
#define bt_hashlist bt_u.u_hashlist |
Definition at line 128 of file subr_vmem.c.
#define BT_ISSPAN_P | ( | bt | ) | ((bt)->bt_type <= BT_TYPE_SPAN_STATIC) |
Definition at line 179 of file subr_vmem.c.
#define BT_MAXALLOC 4 |
#define BT_MAXFREE (BT_MAXALLOC * 8) |
#define BT_TYPE_BUSY 4 /* Used space. */ |
Definition at line 177 of file subr_vmem.c.
#define BT_TYPE_CURSOR 5 /* Cursor for nextfit allocations. */ |
Definition at line 178 of file subr_vmem.c.
#define BT_TYPE_FREE 3 /* Available space. */ |
Definition at line 176 of file subr_vmem.c.
#define BT_TYPE_SPAN 1 /* Allocated from importfn */ |
Definition at line 174 of file subr_vmem.c.
#define BT_TYPE_SPAN_STATIC 2 /* vmem_add() or create. */ |
Definition at line 175 of file subr_vmem.c.
#define ORDER2SIZE | ( | order | ) |
#define QC_NAME_MAX 16 |
Definition at line 97 of file subr_vmem.c.
#define QC_POOL_TO_QCACHE | ( | pool | ) | ((qcache_t *)(pool->pr_qcache)) |
Definition at line 117 of file subr_vmem.c.
#define SIZE2ORDER | ( | size | ) |
#define VMEM_ASSERT_LOCKED | ( | vm | ) | mtx_assert(&vm->vm_lock, MA_OWNED); |
#define VMEM_CONDVAR_BROADCAST | ( | vm | ) | cv_broadcast(&vm->vm_cv) |
#define VMEM_CONDVAR_DESTROY | ( | vm | ) | cv_destroy(&vm->vm_cv) |
#define VMEM_CONDVAR_INIT | ( | vm, | |
wchan | |||
) | cv_init(&vm->vm_cv, wchan) |
#define VMEM_CONDVAR_WAIT | ( | vm | ) | cv_wait(&vm->vm_cv, &vm->vm_lock) |
#define VMEM_CROSS_P | ( | addr1, | |
addr2, | |||
boundary | |||
) | ((((addr1) ^ (addr2)) & -(boundary)) != 0) |
#define VMEM_FITMASK (M_BESTFIT | M_FIRSTFIT | M_NEXTFIT) |
Definition at line 90 of file subr_vmem.c.
#define VMEM_FLAGS |
Definition at line 92 of file subr_vmem.c.
#define VMEM_HASHSIZE_MAX 131072 |
Definition at line 86 of file subr_vmem.c.
#define VMEM_HASHSIZE_MIN 16 |
Definition at line 85 of file subr_vmem.c.
#define VMEM_LOCK | ( | vm | ) | mtx_lock(&vm->vm_lock) |
#define VMEM_LOCK_DESTROY | ( | vm | ) | mtx_destroy(&vm->vm_lock) |
#define VMEM_MAXORDER (VMEM_OPTVALUE - 1 + sizeof(vmem_size_t) * NBBY - VMEM_OPTORDER) |
Definition at line 82 of file subr_vmem.c.
#define VMEM_NAME_MAX 16 |
Definition at line 119 of file subr_vmem.c.
#define VMEM_OPTORDER 5 |
Definition at line 80 of file subr_vmem.c.
#define VMEM_OPTVALUE (1 << VMEM_OPTORDER) |
Definition at line 81 of file subr_vmem.c.
#define vmem_printf printf |
Definition at line 1766 of file subr_vmem.c.
#define VMEM_QCACHE_IDX_MAX 16 |
Definition at line 88 of file subr_vmem.c.
#define VMEM_TRYLOCK | ( | vm | ) | mtx_trylock(&vm->vm_lock) |
#define VMEM_UNLOCK | ( | vm | ) | mtx_unlock(&vm->vm_lock) |
Definition at line 104 of file subr_vmem.c.
Definition at line 116 of file subr_vmem.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 270 of file subr_vmem.c.
References bt, BT_FLAGS, bt_freelist, BT_MAXALLOC, flags, VMEM_ASSERT_LOCKED, VMEM_LOCK, and VMEM_UNLOCK.
Referenced by bt_fill().
|
static |
Definition at line 322 of file subr_vmem.c.
References bt, bt_freelist, and VMEM_ASSERT_LOCKED.
Referenced by vmem_add1(), and vmem_clip().
|
inlinestatic |
Definition at line 311 of file subr_vmem.c.
References _bt_fill(), BT_MAXALLOC, and flags.
Referenced by vmem_add(), vmem_xalloc(), and vmem_xalloc_nextfit().
|
inlinestatic |
Definition at line 361 of file subr_vmem.c.
References bt, bt_freelist, and VMEM_ASSERT_LOCKED.
Referenced by bt_remseg().
|
static |
Definition at line 424 of file subr_vmem.c.
References ORDER2SIZE, SIZE2ORDER, and VMEM_MAXORDER.
Referenced by vmem_xalloc().
|
static |
Definition at line 402 of file subr_vmem.c.
References SIZE2ORDER, and VMEM_MAXORDER.
Referenced by bt_insfree().
|
static |
Definition at line 340 of file subr_vmem.c.
References bt, bt_freelist, LIST_HEAD(), VMEM_ASSERT_LOCKED, and VMEM_UNLOCK.
Referenced by vmem_destroy1(), vmem_try_release(), and vmem_xfree().
|
static |
Definition at line 445 of file subr_vmem.c.
References addr.
Referenced by bt_insbusy(), and bt_lookupbusy().
|
static |
Definition at line 485 of file subr_vmem.c.
References bt, bt_hashhead(), bt_hashlist, BT_TYPE_BUSY, and VMEM_ASSERT_LOCKED.
Referenced by vmem_clip(), and vmem_rehash().
|
static |
Definition at line 533 of file subr_vmem.c.
References bt, bt_freehead_tofree(), and bt_freelist.
Referenced by vmem_add1(), vmem_clip(), and vmem_xfree().
Definition at line 510 of file subr_vmem.c.
References bt.
Referenced by vmem_clip().
|
static |
Definition at line 517 of file subr_vmem.c.
References bt.
Referenced by vmem_add1().
|
static |
Definition at line 259 of file subr_vmem.c.
References bt, and BT_TYPE_FREE.
Referenced by vmem_add1().
|
static |
Definition at line 457 of file subr_vmem.c.
References addr, bt, bt_hashhead(), bt_hashlist, and VMEM_ASSERT_LOCKED.
Referenced by vmem_xfree().
|
static |
Definition at line 474 of file subr_vmem.c.
References bt, bt_hashlist, and VMEM_ASSERT_LOCKED.
Referenced by vmem_rehash(), and vmem_xfree().
|
static |
Definition at line 524 of file subr_vmem.c.
References bt, bt_freelist, and BT_TYPE_FREE.
Referenced by vmem_add1(), vmem_clip(), vmem_try_release(), vmem_xalloc_nextfit(), and vmem_xfree().
|
static |
Definition at line 501 of file subr_vmem.c.
References bt, bt_free(), and BT_TYPE_CURSOR.
Referenced by vmem_destroy1(), vmem_try_release(), vmem_xalloc_nextfit(), and vmem_xfree().
|
static |
Definition at line 383 of file subr_vmem.c.
References BT_MAXALLOC.
Referenced by vmem_import(), and vmem_try_fetch().
|
static |
Definition at line 375 of file subr_vmem.c.
References BT_MAXALLOC.
Referenced by vmem_import(), and vmem_try_fetch().
|
static |
Definition at line 195 of file subr_vmem.c.
LIST_HEAD | ( | vmem_freelist | , |
vmem_btag | |||
) |
LIST_HEAD | ( | vmem_hashlist | , |
vmem_btag | |||
) |
MALLOC_DEFINE | ( | M_VMEM | , |
"vmem" | , | ||
"vmem internal structures" | |||
) |
|
static |
Definition at line 608 of file subr_vmem.c.
Referenced by vmem_destroy1().
|
static |
Definition at line 619 of file subr_vmem.c.
Referenced by vmem_try_fetch().
|
static |
Definition at line 550 of file subr_vmem.c.
References addr, flags, qcache::qc_size, qcache::qc_vmem, and vmem_xalloc().
Referenced by qc_init().
|
static |
Definition at line 583 of file subr_vmem.c.
References qcache::qc_cache, qc_import(), qcache::qc_name, qc_release(), qcache::qc_size, qcache::qc_vmem, snprintf(), and VMEM_QCACHE_IDX_MAX.
Referenced by vmem_init().
|
static |
Definition at line 572 of file subr_vmem.c.
References qcache::qc_size, qcache::qc_vmem, and vmem_xfree().
Referenced by qc_init().
SYSINIT | ( | vfs | , |
SI_SUB_CONFIGURE | , | ||
SI_ORDER_ANY | , | ||
vmem_start_callout | , | ||
NULL | |||
) |
TAILQ_HEAD | ( | vmem_seglist | , |
vmem_btag | |||
) |
int vmem_add | ( | vmem_t * | vm, |
vmem_addr_t | addr, | ||
vmem_size_t | size, | ||
int | flags | ||
) |
Definition at line 1526 of file subr_vmem.c.
References addr, bt_fill(), BT_TYPE_SPAN_STATIC, flags, vmem_add1(), VMEM_FLAGS, VMEM_LOCK, and VMEM_UNLOCK.
Referenced by vmem_init().
|
static |
Definition at line 828 of file subr_vmem.c.
References addr, bt_alloc(), bt_insfree(), bt_insseg_tail(), bt_isfree(), bt_remfree(), vmem_btag::bt_size, vmem_btag::bt_start, vmem_btag::bt_type, BT_TYPE_FREE, BT_TYPE_SPAN, BT_TYPE_SPAN_STATIC, type, and VMEM_ASSERT_LOCKED.
Referenced by vmem_add(), and vmem_import().
int vmem_alloc | ( | vmem_t * | vm, |
vmem_size_t | size, | ||
int | flags, | ||
vmem_addr_t * | addrp | ||
) |
Definition at line 1326 of file subr_vmem.c.
References flags, qcache::qc_cache, VMEM_FITMASK, VMEM_FLAGS, and vmem_xalloc().
Referenced by bufkva_alloc().
|
static |
Definition at line 660 of file subr_vmem.c.
References addr, domain, vmem_bt_lock, vmem_xalloc(), and vmem_xfree().
Referenced by vmem_startup().
|
static |
Definition at line 996 of file subr_vmem.c.
References bt, bt_alloc(), bt_insbusy(), bt_insfree(), bt_insseg(), bt_remfree(), vmem_btag::bt_size, vmem_btag::bt_start, vmem_btag::bt_type, BT_TYPE_BUSY, BT_TYPE_FREE, start, and VMEM_ASSERT_LOCKED.
Referenced by vmem_xalloc(), and vmem_xalloc_nextfit().
vmem_t * vmem_create | ( | const char * | name, |
vmem_addr_t | base, | ||
vmem_size_t | size, | ||
vmem_size_t | quantum, | ||
vmem_size_t | qcache_max, | ||
int | flags | ||
) |
Definition at line 1289 of file subr_vmem.c.
References flags, name, and vmem_init().
void vmem_destroy | ( | vmem_t * | vm | ) |
Definition at line 1305 of file subr_vmem.c.
References vmem_destroy1(), and vmem_list_lock.
|
static |
Definition at line 877 of file subr_vmem.c.
References bt, bt_freetrim(), bt_remseg(), free(), qc_destroy(), VMEM_CONDVAR_DESTROY, VMEM_LOCK, and VMEM_LOCK_DESTROY.
Referenced by vmem_destroy(), and vmem_init().
|
static |
Definition at line 946 of file subr_vmem.c.
References bt, BT_END, phase, start, VMEM_ALIGNUP, and VMEM_CROSS_P.
Referenced by vmem_xalloc(), and vmem_xalloc_nextfit().
void vmem_free | ( | vmem_t * | vm, |
vmem_addr_t | addr, | ||
vmem_size_t | size | ||
) |
Definition at line 1466 of file subr_vmem.c.
References addr, qcache::qc_cache, and vmem_xfree().
Referenced by biodone(), and bufkva_free().
|
static |
Definition at line 907 of file subr_vmem.c.
References addr, bt_restore(), bt_save(), BT_TYPE_SPAN, flags, vmem_add1(), VMEM_LOCK, and VMEM_UNLOCK.
Referenced by vmem_try_fetch().
vmem_t * vmem_init | ( | vmem_t * | vm, |
const char * | name, | ||
vmem_addr_t | base, | ||
vmem_size_t | size, | ||
vmem_size_t | quantum, | ||
vmem_size_t | qcache_max, | ||
int | flags | ||
) |
Definition at line 1236 of file subr_vmem.c.
References BT_TYPE_CURSOR, flags, name, qc_init(), vmem_add(), VMEM_CONDVAR_INIT, vmem_destroy1(), VMEM_HASHSIZE_MIN, vmem_list_lock, VMEM_LOCK_INIT, and VMEM_MAXORDER.
Referenced by vmem_create().
|
static |
Definition at line 778 of file subr_vmem.c.
References VMEM_CONDVAR_BROADCAST, VMEM_HASHSIZE_MAX, VMEM_HASHSIZE_MIN, vmem_list_lock, VMEM_LOCK, vmem_periodic_ch, vmem_periodic_interval, vmem_periodic_kick(), vmem_rehash(), and VMEM_UNLOCK.
Referenced by vmem_start_callout().
|
static |
Definition at line 771 of file subr_vmem.c.
References taskqueue_enqueue(), and vmem_periodic_wk.
Referenced by vmem_periodic(), and vmem_start_callout().
|
static |
Definition at line 730 of file subr_vmem.c.
References bt, bt_insbusy(), bt_rembusy(), free(), malloc(), VMEM_LOCK, and VMEM_UNLOCK.
Referenced by vmem_periodic().
vmem_size_t vmem_roundup_size | ( | vmem_t * | vm, |
vmem_size_t | size | ||
) |
Definition at line 1316 of file subr_vmem.c.
Referenced by vmem_xalloc(), and vmem_xfree().
void vmem_set_import | ( | vmem_t * | vm, |
vmem_import_t * | importfn, | ||
vmem_release_t * | releasefn, | ||
void * | arg, | ||
vmem_size_t | import_quantum | ||
) |
Definition at line 1201 of file subr_vmem.c.
References VMEM_LOCK, and VMEM_UNLOCK.
void vmem_set_limit | ( | vmem_t * | vm, |
vmem_size_t | limit | ||
) |
Definition at line 1215 of file subr_vmem.c.
References VMEM_LOCK, and VMEM_UNLOCK.
void vmem_set_reclaim | ( | vmem_t * | vm, |
vmem_reclaim_t * | reclaimfn | ||
) |
Definition at line 1224 of file subr_vmem.c.
References VMEM_LOCK, and VMEM_UNLOCK.
Referenced by bufinit().
vmem_size_t vmem_size | ( | vmem_t * | vm, |
int | typemask | ||
) |
Definition at line 1545 of file subr_vmem.c.
References ORDER2SIZE, panic(), VMEM_LOCK, VMEM_MAXORDER, and VMEM_UNLOCK.
|
static |
Definition at line 816 of file subr_vmem.c.
References callout_init(), hz, vmem_periodic(), vmem_periodic_ch, vmem_periodic_interval, vmem_periodic_kick(), and vmem_periodic_wk.
void vmem_startup | ( | void | ) |
Definition at line 702 of file subr_vmem.c.
References BT_MAXALLOC, mp_ncpus, vmem_bt_alloc(), vmem_bt_lock, and vmem_list_lock.
|
static |
Definition at line 1038 of file subr_vmem.c.
References bt_restore(), bt_save(), flags, qc_drain(), VMEM_ASSERT_LOCKED, VMEM_CONDVAR_WAIT, vmem_import(), VMEM_LOCK, and VMEM_UNLOCK.
Referenced by vmem_xalloc(), and vmem_xalloc_nextfit().
|
static |
Definition at line 1079 of file subr_vmem.c.
References bt, bt_freetrim(), BT_MAXFREE, bt_remfree(), bt_remseg(), vmem_btag::bt_size, vmem_btag::bt_start, vmem_btag::bt_type, BT_TYPE_FREE, BT_TYPE_SPAN, and VMEM_CONDVAR_BROADCAST.
Referenced by vmem_xalloc_nextfit(), and vmem_xfree().
int vmem_xalloc | ( | vmem_t * | vm, |
const vmem_size_t | size0, | ||
vmem_size_t | align, | ||
const vmem_size_t | phase, | ||
const vmem_size_t | nocross, | ||
const vmem_addr_t | minaddr, | ||
const vmem_addr_t | maxaddr, | ||
int | flags, | ||
vmem_addr_t * | addrp | ||
) |
Definition at line 1355 of file subr_vmem.c.
References bt, bt_fill(), bt_freehead_toalloc(), bt_freelist, flags, panic(), phase, vmem_clip(), VMEM_CROSS_P, vmem_fit(), VMEM_FITMASK, VMEM_FLAGS, VMEM_LOCK, VMEM_MAXORDER, vmem_roundup_size(), vmem_try_fetch(), VMEM_UNLOCK, and vmem_xalloc_nextfit().
Referenced by qc_import(), vmem_alloc(), and vmem_bt_alloc().
|
static |
Definition at line 1113 of file subr_vmem.c.
References bt, bt_fill(), bt_remfree(), bt_remseg(), vmem_btag::bt_size, vmem_btag::bt_start, vmem_btag::bt_type, BT_TYPE_FREE, flags, phase, vmem_clip(), vmem_fit(), VMEM_LOCK, vmem_try_fetch(), vmem_try_release(), and VMEM_UNLOCK.
Referenced by vmem_xalloc().
void vmem_xfree | ( | vmem_t * | vm, |
vmem_addr_t | addr, | ||
vmem_size_t size | __unused | ||
) |
Definition at line 1480 of file subr_vmem.c.
References addr, bt, BT_END, bt_freetrim(), bt_insfree(), bt_lookupbusy(), BT_MAXFREE, bt_rembusy(), bt_remfree(), bt_remseg(), vmem_btag::bt_size, vmem_btag::bt_start, vmem_btag::bt_type, BT_TYPE_BUSY, BT_TYPE_FREE, VMEM_CONDVAR_BROADCAST, VMEM_LOCK, vmem_roundup_size(), and vmem_try_release().
Referenced by qc_release(), vmem_bt_alloc(), and vmem_free().
|
static |
Definition at line 631 of file subr_vmem.c.
Referenced by vmem_bt_alloc(), and vmem_startup().
|
static |
Definition at line 194 of file subr_vmem.c.
Referenced by vmem_destroy(), vmem_init(), vmem_periodic(), and vmem_startup().
|
static |
Definition at line 190 of file subr_vmem.c.
Referenced by vmem_periodic(), and vmem_start_callout().
|
static |
Definition at line 191 of file subr_vmem.c.
Referenced by vmem_periodic(), and vmem_start_callout().
|
static |
Definition at line 192 of file subr_vmem.c.
Referenced by vmem_periodic_kick(), and vmem_start_callout().