Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/swap_pager.c
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | SYSCTL_INT(_vm, VM_OVERCOMMIT, overcommit, CTLFLAG_RW, &overcommit, 0, | ||||
"for details."); | "for details."); | ||||
static unsigned long swzone; | static unsigned long swzone; | ||||
SYSCTL_ULONG(_vm, OID_AUTO, swzone, CTLFLAG_RD, &swzone, 0, | SYSCTL_ULONG(_vm, OID_AUTO, swzone, CTLFLAG_RD, &swzone, 0, | ||||
"Actual size of swap metadata zone"); | "Actual size of swap metadata zone"); | ||||
static unsigned long swap_maxpages; | static unsigned long swap_maxpages; | ||||
SYSCTL_ULONG(_vm, OID_AUTO, swap_maxpages, CTLFLAG_RD, &swap_maxpages, 0, | SYSCTL_ULONG(_vm, OID_AUTO, swap_maxpages, CTLFLAG_RD, &swap_maxpages, 0, | ||||
"Maximum amount of swap supported"); | "Maximum amount of swap supported"); | ||||
static counter_u64_t swap_free_deferred; | static COUNTER_U64_DEFINE_EARLY(swap_free_deferred); | ||||
SYSCTL_COUNTER_U64(_vm_stats_swap, OID_AUTO, free_deferred, | SYSCTL_COUNTER_U64(_vm_stats_swap, OID_AUTO, free_deferred, | ||||
CTLFLAG_RD, &swap_free_deferred, | CTLFLAG_RD, &swap_free_deferred, | ||||
"Number of pages that deferred freeing swap space"); | "Number of pages that deferred freeing swap space"); | ||||
static counter_u64_t swap_free_completed; | static COUNTER_U64_DEFINE_EARLY(swap_free_completed); | ||||
SYSCTL_COUNTER_U64(_vm_stats_swap, OID_AUTO, free_completed, | SYSCTL_COUNTER_U64(_vm_stats_swap, OID_AUTO, free_completed, | ||||
CTLFLAG_RD, &swap_free_completed, | CTLFLAG_RD, &swap_free_completed, | ||||
"Number of deferred frees completed"); | "Number of deferred frees completed"); | ||||
/* bits from overcommit */ | /* bits from overcommit */ | ||||
#define SWAP_RESERVE_FORCE_ON (1 << 0) | #define SWAP_RESERVE_FORCE_ON (1 << 0) | ||||
#define SWAP_RESERVE_RLIMIT_ON (1 << 1) | #define SWAP_RESERVE_RLIMIT_ON (1 << 1) | ||||
#define SWAP_RESERVE_ALLOW_NONWIRED (1 << 2) | #define SWAP_RESERVE_ALLOW_NONWIRED (1 << 2) | ||||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Lines | swap_pager_init(void) | ||||
int i; | int i; | ||||
for (i = 0; i < NOBJLISTS; ++i) | for (i = 0; i < NOBJLISTS; ++i) | ||||
TAILQ_INIT(&swap_pager_object_list[i]); | TAILQ_INIT(&swap_pager_object_list[i]); | ||||
mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); | mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF); | ||||
sx_init(&sw_alloc_sx, "swspsx"); | sx_init(&sw_alloc_sx, "swspsx"); | ||||
sx_init(&swdev_syscall_lock, "swsysc"); | sx_init(&swdev_syscall_lock, "swsysc"); | ||||
} | } | ||||
static void | |||||
swap_pager_counters(void) | |||||
{ | |||||
swap_free_deferred = counter_u64_alloc(M_WAITOK); | |||||
swap_free_completed = counter_u64_alloc(M_WAITOK); | |||||
} | |||||
SYSINIT(swap_counters, SI_SUB_CPU, SI_ORDER_ANY, swap_pager_counters, NULL); | |||||
/* | /* | ||||
* SWAP_PAGER_SWAP_INIT() - swap pager initialization from pageout process | * SWAP_PAGER_SWAP_INIT() - swap pager initialization from pageout process | ||||
* | * | ||||
* Expected to be started from pageout process once, prior to entering | * Expected to be started from pageout process once, prior to entering | ||||
* its main loop. | * its main loop. | ||||
*/ | */ | ||||
void | void | ||||
▲ Show 20 Lines • Show All 2,545 Lines • Show Last 20 Lines |