Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_vmem.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/condvar.h> | #include <sys/condvar.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/taskqueue.h> | #include <sys/taskqueue.h> | ||||
#include <sys/vmem.h> | #include <sys/vmem.h> | ||||
#include <sys/vmmeter.h> | |||||
#include "opt_vm.h" | #include "opt_vm.h" | ||||
#include <vm/uma.h> | #include <vm/uma.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/vm_object.h> | #include <vm/vm_object.h> | ||||
#include <vm/vm_kern.h> | #include <vm/vm_kern.h> | ||||
#include <vm/vm_extern.h> | #include <vm/vm_extern.h> | ||||
#include <vm/vm_param.h> | #include <vm/vm_param.h> | ||||
#include <vm/vm_page.h> | #include <vm/vm_page.h> | ||||
#include <vm/vm_pageout.h> | #include <vm/vm_pageout.h> | ||||
#include <vm/vm_phys.h> | |||||
#include <vm/vm_pagequeue.h> | |||||
#define VMEM_OPTORDER 5 | #define VMEM_OPTORDER 5 | ||||
#define VMEM_OPTVALUE (1 << VMEM_OPTORDER) | #define VMEM_OPTVALUE (1 << VMEM_OPTORDER) | ||||
#define VMEM_MAXORDER \ | #define VMEM_MAXORDER \ | ||||
(VMEM_OPTVALUE - 1 + sizeof(vmem_size_t) * NBBY - VMEM_OPTORDER) | (VMEM_OPTVALUE - 1 + sizeof(vmem_size_t) * NBBY - VMEM_OPTORDER) | ||||
#define VMEM_HASHSIZE_MIN 16 | #define VMEM_HASHSIZE_MIN 16 | ||||
#define VMEM_HASHSIZE_MAX 131072 | #define VMEM_HASHSIZE_MAX 131072 | ||||
▲ Show 20 Lines • Show All 553 Lines • ▼ Show 20 Lines | if (vmem_xalloc(vm_dom[domain].vmd_kernel_arena, bytes, 0, 0, 0, | ||||
} | } | ||||
vmem_xfree(vm_dom[domain].vmd_kernel_arena, addr, bytes); | vmem_xfree(vm_dom[domain].vmd_kernel_arena, addr, bytes); | ||||
mtx_unlock(&vmem_bt_lock); | mtx_unlock(&vmem_bt_lock); | ||||
/* | /* | ||||
* Out of memory, not address space. This may not even be | * Out of memory, not address space. This may not even be | ||||
* possible due to M_USE_RESERVE page allocation. | * possible due to M_USE_RESERVE page allocation. | ||||
*/ | */ | ||||
if (wait & M_WAITOK) | if (wait & M_WAITOK) | ||||
VM_WAIT; | vm_wait_domain(domain); | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
mtx_unlock(&vmem_bt_lock); | mtx_unlock(&vmem_bt_lock); | ||||
/* | /* | ||||
* We're either out of address space or lost a fill race. | * We're either out of address space or lost a fill race. | ||||
*/ | */ | ||||
if (wait & M_WAITOK) | if (wait & M_WAITOK) | ||||
pause("btalloc", 1); | pause("btalloc", 1); | ||||
▲ Show 20 Lines • Show All 956 Lines • Show Last 20 Lines |