1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Allow to create swap zone larger than v_page_count / 2.

If user configured the maxswapzone tunable, just take the literal
value for the initial zone sizing attempt.  Before, it was only
possible to reduce the zone by the tunable.

While there, correct the message which was not correct when zone
creation rounded the size up.

Reported by:	jmg
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D18381
This commit is contained in:
Konstantin Belousov 2018-12-01 16:50:12 +00:00
parent 36e1b9702e
commit a823302783
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341375

View File

@ -547,12 +547,12 @@ swap_pager_swap_init(void)
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.
*/ */
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)
@ -580,7 +580,7 @@ swap_pager_swap_init(void)
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",
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);