From 8178c126aafa027ea046f22faf5d4505c3ac9745 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 26 Jan 2017 11:34:31 -0800 Subject: [PATCH] kernel - Accomodate high-ncpu + low-mem configurations * Make some adjustments to accomodate high cpu core count but low physical memory configurations. This mainly accomodates test configurations. Do set pageout minimums or targets to unreasonable values in these configurations. --- sys/vm/vm_pageout.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index baf7e30be5..a1f814ef81 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1791,9 +1791,16 @@ vm_pageout_free_page_calc(vm_size_t count) /* * Make sure the vmmeter slop can't blow out our global minimums. + * + * However, to accomodate weird configurations (vkernels with many + * cpus and little memory, or artifically reduced hw.physmem), do + * not allow v_free_min to exceed 1/20 of ram or the pageout demon + * will go out of control. */ if (vmstats.v_free_min < VMMETER_SLOP_COUNT * ncpus * 10) vmstats.v_free_min = VMMETER_SLOP_COUNT * ncpus * 10; + if (vmstats.v_free_min > vmstats.v_page_count / 20) + vmstats.v_free_min = vmstats.v_page_count / 20; vmstats.v_free_reserved = vmstats.v_free_min * 4 / 8 + 7; vmstats.v_free_severe = vmstats.v_free_min * 4 / 8 + 0; @@ -1836,9 +1843,11 @@ vm_pageout_thread(void) * is signalled and run to free more pages. */ if (vmstats.v_free_count > 6144) - vmstats.v_free_target = 4 * vmstats.v_free_min + vmstats.v_free_reserved; + vmstats.v_free_target = 4 * vmstats.v_free_min + + vmstats.v_free_reserved; else - vmstats.v_free_target = 2 * vmstats.v_free_min + vmstats.v_free_reserved; + vmstats.v_free_target = 2 * vmstats.v_free_min + + vmstats.v_free_reserved; /* * NOTE: With the new buffer cache b_act_count we want the default -- 2.11.4.GIT