Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/swap_pager.c
Show First 20 Lines • Show All 627 Lines • ▼ Show 20 Lines | swap_pager_swap_init(void) | ||||
* Initialize our zone, taking the user's requested size or | * Initialize our zone, taking the user's requested size or | ||||
* estimating the number we need based on the number of pages | * estimating the number we need based on the number of pages | ||||
* in the system. | * in the system. | ||||
*/ | */ | ||||
n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) : | n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) : | ||||
vm_cnt.v_page_count / 2; | vm_cnt.v_page_count / 2; | ||||
swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, | swpctrie_zone = uma_zcreate("swpctrie", pctrie_node_size(), NULL, NULL, | ||||
pctrie_zone_init, NULL, UMA_ALIGN_PTR, 0); | pctrie_zone_init, NULL, UMA_ALIGN_PTR, 0); | ||||
if (swpctrie_zone == NULL) | |||||
panic("failed to create swap pctrie zone."); | |||||
swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL, | swblk_zone = uma_zcreate("swblk", sizeof(struct swblk), NULL, NULL, | ||||
NULL, NULL, _Alignof(struct swblk) - 1, 0); | NULL, NULL, _Alignof(struct swblk) - 1, 0); | ||||
if (swblk_zone == NULL) | |||||
panic("failed to create swap blk zone."); | |||||
n2 = n; | n2 = n; | ||||
do { | do { | ||||
if (uma_zone_reserve_kva(swblk_zone, n)) | if (uma_zone_reserve_kva(swblk_zone, n)) | ||||
break; | break; | ||||
/* | /* | ||||
* if the allocation failed, try a zone two thirds the | * if the allocation failed, try a zone two thirds the | ||||
* size of the previous attempt. | * size of the previous attempt. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 2,526 Lines • Show Last 20 Lines |