On 5/11/22 12:52, Mark Millard wrote:
Relative to avoiding hang-ups, so far it seems that use of vm.swap_enabled=0 with vm.swap_idle_enabled=0 makes hang-ups less likely/less frequent/harder to produce examples of. But is no guarantee of lack of a hang-up. Its does change the cause of the hang-up (in that it avoids processes with kernel stacks swapped out being involved).
thanks for the above analysis Mark. i am going to test these settings out now as i'm still seeing the lockup.
this most recent hang-up was using a patch tijl@ asked me to test (attached to this email), and the default setting of vm.pageout_oom_seq: 12. interestingly enough with the patch applied i observed a smaller amount of memory used for laundry as well as less swap space used until right before the crash.
cheers, -p -- Pete Wright p...@nomadlogic.org @nomadlogicLA
From f3260a2eb1cdc86f9216b7923d7b09704a37e79d Mon Sep 17 00:00:00 2001 From: Tijl Coosemans <t...@freebsd.org> Date: Sun, 8 May 2022 12:19:28 +0200 Subject: [PATCH] vm: stop background laundering when no progress Let vm_pageout_laundry_worker go to sleep when it cannot make progress (nfreed == 0). This allows other threads to run so they can hopefully free some memory. This restores behaviour from before c098768e4dad and 60684862588f and prevents some OOM kills. Tested by: Pete Wright <p...@nomadlogic.org> MFC after: 2 weeks --- sys/vm/vm_pageout.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 36d5f3275800..fbb2cd4128f0 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1061,15 +1061,13 @@ vm_pageout_laundry_worker(void *arg) * clean pages freed by the page daemon since the last * background laundering. Thus, as the ratio of dirty to * clean inactive pages grows, the amount of memory pressure - * required to trigger laundering decreases. We ensure - * that the threshold is non-zero after an inactive queue - * scan, even if that scan failed to free a single clean page. + * required to trigger laundering decreases. */ trybackground: nclean = vmd->vmd_free_count + vmd->vmd_pagequeues[PQ_INACTIVE].pq_cnt; ndirty = vmd->vmd_pagequeues[PQ_LAUNDRY].pq_cnt; - if (target == 0 && ndirty * isqrt(howmany(nfreed + 1, + if (target == 0 && ndirty * isqrt(howmany(nfreed, vmd->vmd_free_target - vmd->vmd_free_min)) >= nclean) { target = vmd->vmd_background_launder_target; } -- 2.35.1