Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/swap_pager.c
Show First 20 Lines • Show All 541 Lines • ▼ Show 20 Lines | swap_pager_swap_init(void) | ||||
mtx_lock(&pbuf_mtx); | mtx_lock(&pbuf_mtx); | ||||
nsw_rcount = (nswbuf + 1) / 2; | nsw_rcount = (nswbuf + 1) / 2; | ||||
nsw_wcount_sync = (nswbuf + 3) / 4; | nsw_wcount_sync = (nswbuf + 3) / 4; | ||||
nsw_wcount_async = 4; | nsw_wcount_async = 4; | ||||
nsw_wcount_async_max = nsw_wcount_async; | nsw_wcount_async_max = nsw_wcount_async; | ||||
mtx_unlock(&pbuf_mtx); | mtx_unlock(&pbuf_mtx); | ||||
/* | /* | ||||
* Initialize our zone, guessing on the number we need based | * Initialize our zone, taking the user's requested size or | ||||
* on the number of pages in the system. | * estimating the number we need based on the number of pages | ||||
* in the system. | |||||
markj: Perhaps, "taking the user's requested size or estimating the number we need..."? | |||||
*/ | */ | ||||
n = vm_cnt.v_page_count / 2; | n = maxswzone != 0 ? maxswzone / sizeof(struct swblk) : | ||||
if (maxswzone && n > maxswzone / sizeof(struct swblk)) | vm_cnt.v_page_count / 2; | ||||
n = maxswzone / sizeof(struct swblk); | |||||
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, UMA_ZONE_VM); | pctrie_zone_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); | ||||
if (swpctrie_zone == NULL) | if (swpctrie_zone == NULL) | ||||
panic("failed to create swap pctrie zone."); | 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, UMA_ZONE_VM); | NULL, NULL, _Alignof(struct swblk) - 1, UMA_ZONE_VM); | ||||
if (swblk_zone == NULL) | if (swblk_zone == NULL) | ||||
panic("failed to create swap blk zone."); | panic("failed to create swap blk zone."); | ||||
Show All 11 Lines | swap_pager_swap_init(void) | ||||
/* | /* | ||||
* Often uma_zone_reserve_kva() cannot reserve exactly the | * Often uma_zone_reserve_kva() cannot reserve exactly the | ||||
* requested size. Account for the difference when | * requested size. Account for the difference when | ||||
* calculating swap_maxpages. | * calculating swap_maxpages. | ||||
*/ | */ | ||||
n = uma_zone_get_max(swblk_zone); | n = uma_zone_get_max(swblk_zone); | ||||
if (n < n2) | if (n < n2) | ||||
printf("Swap blk zone entries reduced from %lu to %lu.\n", | printf("Swap blk zone entries changed from %lu to %lu.\n", | ||||
Not Done Inline ActionsDid you make this change because uma_zone_reserve_kva() can round up? markj: Did you make this change because uma_zone_reserve_kva() can round up? | |||||
Done Inline ActionsYes, somebody noted it to me long time ago, but I did not considered it worth fixing alone. kib: Yes, somebody noted it to me long time ago, but I did not considered it worth fixing alone. | |||||
n2, n); | n2, n); | ||||
swap_maxpages = n * SWAP_META_PAGES; | swap_maxpages = n * SWAP_META_PAGES; | ||||
swzone = n * sizeof(struct swblk); | swzone = n * sizeof(struct swblk); | ||||
if (!uma_zone_reserve_kva(swpctrie_zone, n)) | if (!uma_zone_reserve_kva(swpctrie_zone, n)) | ||||
printf("Cannot reserve swap pctrie zone, " | printf("Cannot reserve swap pctrie zone, " | ||||
"reduce kern.maxswzone.\n"); | "reduce kern.maxswzone.\n"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,314 Lines • Show Last 20 Lines |
Perhaps, "taking the user's requested size or estimating the number we need..."?