From 05c33a209bd0403f851f4ffd54fe4d16a1a663ef Mon Sep 17 00:00:00 2001 From: dillon Date: Mon, 20 Aug 2001 00:41:12 +0000 Subject: Limit the amount of KVM reserved for the buffer cache and for swap-meta information. The default limits only effect machines with > 1GB of ram and can be overriden with two new kernel conf variables VM_SWZONE_SIZE_MAX and VM_BCACHE_SIZE_MAX, or with loader variables kern.maxswzone and kern.maxbcache. This has the effect of leaving more KVM available for sizing NMBCLUSTERS and 'maxusers' and should avoid tripups where a sysad adds memory to a machine and then sees the kernel panic on boot due to running out of KVM. Also change the default swap-meta auto-sizing calculation to allocate half of what it was previously allocating. The prior defaults were way too high. Note that we cannot afford to run out of swap-meta structures so we still stay somewhat conservative here. --- sys/vm/swap_pager.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sys/vm') diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f2d6061..e25a556 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -323,10 +323,13 @@ swap_pager_swap_init() /* * Initialize our zone. Right now I'm just guessing on the number * we need based on the number of pages in the system. Each swblock - * can hold 16 pages, so this is probably overkill. + * can hold 16 pages, so this is probably overkill. This reservation + * is typically limited to around 70MB by default. */ - n = min(cnt.v_page_count, (kernel_map->max_offset - kernel_map->min_offset) / PAGE_SIZE) * 2; + n = cnt.v_page_count; + if (maxswzone && n > maxswzone / sizeof(struct swblock)) + n = maxswzone / sizeof(struct swblock); n2 = n; do { -- cgit v1.1