Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/vm_reserv.c
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
* The reservation system supports the speculative allocation of large physical | * The reservation system supports the speculative allocation of large physical | ||||
* pages ("superpages"). Speculative allocation enables the fully automatic | * pages ("superpages"). Speculative allocation enables the fully automatic | ||||
* utilization of superpages by the virtual memory system. In other words, no | * utilization of superpages by the virtual memory system. In other words, no | ||||
* programmatic directives are required to use superpages. | * programmatic directives are required to use superpages. | ||||
*/ | */ | ||||
#if VM_NRESERVLEVEL > 0 | #if VM_NRESERVLEVEL > 0 | ||||
#ifndef VM_LEVEL_0_ORDER_MAX | |||||
#define VM_LEVEL_0_ORDER_MAX VM_LEVEL_0_ORDER | |||||
#endif | |||||
/* | /* | ||||
* The number of small pages that are contained in a level 0 reservation | * The number of small pages that are contained in a level 0 reservation | ||||
*/ | */ | ||||
#define VM_LEVEL_0_NPAGES (1 << VM_LEVEL_0_ORDER) | #define VM_LEVEL_0_NPAGES (1 << VM_LEVEL_0_ORDER) | ||||
#define VM_LEVEL_0_NPAGES_MAX (1 << VM_LEVEL_0_ORDER_MAX) | |||||
/* | /* | ||||
* The number of bits by which a physical address is shifted to obtain the | * The number of bits by which a physical address is shifted to obtain the | ||||
* reservation number | * reservation number | ||||
*/ | */ | ||||
#define VM_LEVEL_0_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT) | #define VM_LEVEL_0_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT) | ||||
/* | /* | ||||
Show All 17 Lines | |||||
* The number of bits in a population map entry | * The number of bits in a population map entry | ||||
*/ | */ | ||||
#define NBPOPMAP (NBBY * sizeof(popmap_t)) | #define NBPOPMAP (NBBY * sizeof(popmap_t)) | ||||
/* | /* | ||||
* The number of population map entries in a reservation | * The number of population map entries in a reservation | ||||
*/ | */ | ||||
#define NPOPMAP howmany(VM_LEVEL_0_NPAGES, NBPOPMAP) | #define NPOPMAP howmany(VM_LEVEL_0_NPAGES, NBPOPMAP) | ||||
#define NPOPMAP_MAX howmany(VM_LEVEL_0_NPAGES_MAX, NBPOPMAP) | |||||
/* | /* | ||||
* Number of elapsed ticks before we update the LRU queue position. Used | * Number of elapsed ticks before we update the LRU queue position. Used | ||||
* to reduce contention and churn on the list. | * to reduce contention and churn on the list. | ||||
*/ | */ | ||||
#define PARTPOPSLOP 1 | #define PARTPOPSLOP 1 | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | struct vm_reserv { | ||||
LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ | LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ | ||||
vm_object_t object; /* (o, r) containing object */ | vm_object_t object; /* (o, r) containing object */ | ||||
vm_pindex_t pindex; /* (o, r) offset in object */ | vm_pindex_t pindex; /* (o, r) offset in object */ | ||||
vm_page_t pages; /* (c) first page */ | vm_page_t pages; /* (c) first page */ | ||||
uint16_t domain; /* (c) NUMA domain. */ | uint16_t domain; /* (c) NUMA domain. */ | ||||
uint16_t popcnt; /* (r) # of pages in use */ | uint16_t popcnt; /* (r) # of pages in use */ | ||||
int lasttick; /* (r) last pop update tick. */ | int lasttick; /* (r) last pop update tick. */ | ||||
char inpartpopq; /* (d) */ | char inpartpopq; /* (d) */ | ||||
popmap_t popmap[NPOPMAP]; /* (r) bit vector, used pages */ | popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ | ||||
}; | }; | ||||
#define vm_reserv_lockptr(rv) (&(rv)->lock) | #define vm_reserv_lockptr(rv) (&(rv)->lock) | ||||
#define vm_reserv_assert_locked(rv) \ | #define vm_reserv_assert_locked(rv) \ | ||||
mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) | mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) | ||||
#define vm_reserv_lock(rv) mtx_lock(vm_reserv_lockptr(rv)) | #define vm_reserv_lock(rv) mtx_lock(vm_reserv_lockptr(rv)) | ||||
#define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) | #define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) | ||||
#define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) | #define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) | ||||
▲ Show 20 Lines • Show All 1,301 Lines • Show Last 20 Lines |