FreeBSD virtual memory subsystem code
|
#include <sys/cdefs.h>
#include "opt_vm.h"
#include "opt_kstack_pages.h"
#include "opt_kstack_max_pages.h"
#include "opt_kstack_usage_prof.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/asan.h>
#include <sys/domainset.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/msan.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/racct.h>
#include <sys/refcount.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/sched.h>
#include <sys/sf_buf.h>
#include <sys/shm.h>
#include <sys/smp.h>
#include <sys/vmmeter.h>
#include <sys/vmem.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/unistd.h>
#include <vm/uma.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_domainset.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_pageout.h>
#include <vm/vm_object.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
#include <vm/vm_pager.h>
#include <vm/swap_pager.h>
#include <machine/cpu.h>
Go to the source code of this file.
Functions | |
__FBSDID ("$FreeBSD$") | |
int | kernacc (void *addr, int len, int rw) |
int | useracc (void *addr, int len, int rw) |
int | vslock (void *addr, size_t len) |
void | vsunlock (void *addr, size_t len) |
static vm_page_t | vm_imgact_hold_page (vm_object_t object, vm_ooffset_t offset) |
struct sf_buf * | vm_imgact_map_page (vm_object_t object, vm_ooffset_t offset) |
void | vm_imgact_unmap_page (struct sf_buf *sf) |
void | vm_sync_icache (vm_map_t map, vm_offset_t va, vm_offset_t sz) |
static int | sysctl_kstack_cache_size (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_vm, OID_AUTO, kstack_cache_size, CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_RW, &kstack_cache_size, 0, sysctl_kstack_cache_size, "IU", "Maximum number of cached kernel stacks") | |
static vm_offset_t | vm_thread_stack_create (struct domainset *ds, int pages) |
static void | vm_thread_stack_dispose (vm_offset_t ks, int pages) |
int | vm_thread_new (struct thread *td, int pages) |
void | vm_thread_dispose (struct thread *td) |
void | vm_thread_stack_back (struct domainset *ds, vm_offset_t ks, vm_page_t ma[], int npages, int req_class) |
static int | kstack_import (void *arg, void **store, int cnt, int domain, int flags) |
static void | kstack_release (void *arg, void **store, int cnt) |
static void | kstack_cache_init (void *null) |
SYSINIT (vm_kstacks, SI_SUB_KMEM, SI_ORDER_ANY, kstack_cache_init, NULL) | |
int | vm_forkproc (struct thread *td, struct proc *p2, struct thread *td2, struct vmspace *vm2, int flags) |
void | vm_waitproc (struct proc *p) |
void | kick_proc0 (void) |
Variables | |
vm_object_t | kstack_object |
static uma_zone_t | kstack_cache |
static int | kstack_cache_size |
__FBSDID | ( | "$FreeBSD$" | ) |
int kernacc | ( | void * | addr, |
int | len, | ||
int | rw | ||
) |
Definition at line 121 of file vm_glue.c.
References kernel_map, vm_map_check_protection(), vm_map_lock_read, vm_map_max(), vm_map_unlock_read, and VM_PROT_ALL.
|
static |
Definition at line 464 of file vm_glue.c.
References kstack_cache, kstack_cache_size, kstack_import(), kstack_object, kstack_release(), OBJT_SWAP, uma_zcache_create(), UMA_ZONE_FIRSTTOUCH, uma_zone_set_maxcache(), and vm_object_allocate().
|
static |
Definition at line 433 of file vm_glue.c.
References UMA_ANYDOMAIN, and vm_thread_stack_create().
Referenced by kstack_cache_init().
|
static |
Definition at line 452 of file vm_glue.c.
References vm_thread_stack_dispose().
Referenced by kstack_cache_init().
|
static |
Definition at line 274 of file vm_glue.c.
References kstack_cache, kstack_cache_size, and uma_zone_set_maxcache().
SYSCTL_PROC | ( | _vm | , |
OID_AUTO | , | ||
kstack_cache_size | , | ||
CTLTYPE_INT|CTLFLAG_MPSAFE| | CTLFLAG_RW, | ||
& | kstack_cache_size, | ||
0 | , | ||
sysctl_kstack_cache_size | , | ||
"IU" | , | ||
"Maximum number of cached kernel stacks" | |||
) |
SYSINIT | ( | vm_kstacks | , |
SI_SUB_KMEM | , | ||
SI_ORDER_ANY | , | ||
kstack_cache_init | , | ||
NULL | |||
) |
int useracc | ( | void * | addr, |
int | len, | ||
int | rw | ||
) |
Definition at line 153 of file vm_glue.c.
References vm_map_check_protection(), vm_map_lock_read, vm_map_max(), vm_map_unlock_read, and VM_PROT_ALL.
int vm_forkproc | ( | struct thread * | td, |
struct proc * | p2, | ||
struct thread * | td2, | ||
struct vmspace * | vm2, | ||
int | flags | ||
) |
Definition at line 532 of file vm_glue.c.
References vm_wait_doms(), and vmspace_unshare().
|
static |
Definition at line 221 of file vm_glue.c.
References OFF_TO_IDX, VM_ALLOC_NOBUSY, VM_ALLOC_NORMAL, VM_ALLOC_WIRED, and vm_page_grab_valid_unlocked().
Referenced by vm_imgact_map_page().
struct sf_buf * vm_imgact_map_page | ( | vm_object_t | object, |
vm_ooffset_t | offset | ||
) |
Definition at line 237 of file vm_glue.c.
References vm_imgact_hold_page().
void vm_imgact_unmap_page | ( | struct sf_buf * | sf | ) |
Definition at line 252 of file vm_glue.c.
References PQ_ACTIVE, and vm_page_unwire().
void vm_sync_icache | ( | vm_map_t | map, |
vm_offset_t | va, | ||
vm_offset_t | sz | ||
) |
Definition at line 263 of file vm_glue.c.
References vm_map::pmap, and pmap_sync_icache().
void vm_thread_dispose | ( | struct thread * | td | ) |
Definition at line 387 of file vm_glue.c.
References kstack_cache, uma_zfree(), and vm_thread_stack_dispose().
int vm_thread_new | ( | struct thread * | td, |
int | pages | ||
) |
Definition at line 352 of file vm_glue.c.
References kstack_cache, KSTACK_MAX_PAGES, uma_zalloc(), and vm_thread_stack_create().
void vm_thread_stack_back | ( | struct domainset * | ds, |
vm_offset_t | ks, | ||
vm_page_t | ma[], | ||
int | npages, | ||
int | req_class | ||
) |
Definition at line 408 of file vm_glue.c.
References vm_object::domain, kstack_object, VM_ALLOC_WAITFAIL, VM_ALLOC_WIRED, vm_ndomains, VM_OBJECT_WLOCK, VM_OBJECT_WUNLOCK, and vm_page_grab_pages().
Referenced by vm_thread_stack_create(), and vm_thread_swapin().
|
static |
Definition at line 292 of file vm_glue.c.
References KSTACK_MAX_PAGES, kva_alloc(), pmap_qenter(), pmap_qremove(), VM_ALLOC_NORMAL, vm_page_valid(), and vm_thread_stack_back().
Referenced by kstack_import(), and vm_thread_new().
|
static |
Definition at line 324 of file vm_glue.c.
References kstack_object, kva_free(), pmap_qremove(), VM_OBJECT_WLOCK, VM_OBJECT_WUNLOCK, vm_page_free(), vm_page_lookup(), vm_page_unwire_noq(), and vm_page_xbusy_claim.
Referenced by kstack_release(), and vm_thread_dispose().
void vm_waitproc | ( | struct proc * | p | ) |
Definition at line 583 of file vm_glue.c.
References vmspace_exitfree().
int vslock | ( | void * | addr, |
size_t | len | ||
) |
Definition at line 175 of file vm_glue.c.
References KERN_SUCCESS, vm_map_wire(), VM_MAP_WIRE_NOHOLES, VM_MAP_WIRE_SYSTEM, and vm_page_max_user_wired.
void vsunlock | ( | void * | addr, |
size_t | len | ||
) |
Definition at line 204 of file vm_glue.c.
References vm_map_unwire(), VM_MAP_WIRE_NOHOLES, and VM_MAP_WIRE_SYSTEM.
|
static |
Definition at line 270 of file vm_glue.c.
Referenced by kstack_cache_init(), sysctl_kstack_cache_size(), vm_thread_dispose(), and vm_thread_new().
|
static |
Definition at line 271 of file vm_glue.c.
Referenced by kstack_cache_init(), and sysctl_kstack_cache_size().
vm_object_t kstack_object |
Definition at line 269 of file vm_glue.c.
Referenced by kstack_cache_init(), vm_thread_stack_back(), vm_thread_stack_dispose(), vm_thread_swapin(), and vm_thread_swapout().