Re: Chasing OOM Issues - good sysctl metrics to use?

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 29 May 2022 18:16:09 UTC
On 2022-May-29, at 10:07, Pete Wright <pete@nomadlogic.org> wrote:

> On 5/14/22 01:09, Mark Millard wrote:
>> 
>> One of the points is to see if I get any evidence of
>> vm.swap_enabled=0 with vm.swap_idle_enabled=0 ending up
>> contributing to any problems in my normal usage. So far: no.
>> vm.pageout_oom_seq=120 is in use for this, my normal
>> context since sometime in 2018.
> 
> So to revive an old thread here.
> 
> it looks like setting these two sysctl knobs have helped the situation:
> vm.swap_enabled=0
> vm.swap_idle_enabled=0
> 
> i've gone 7 days without any OOM events under normal work usage (as opposed to about 4days previously).

FYI, the combination:

vm.pageout_oom_seq=120 # in /boot/loader.conf
vm.swap_enabled=0      # in /etc/sysctl.conf
vm.swap_idle_enabled=0 # in /etc/sysctl.conf

still has not caused me any additional problems
and helps avoid loss of access by avoiding the
relevant interaction-processes from having their
kernel stacks swapped out. (Not that the effect
of vm.swap_enabled=0 is limited to
interaction-processes.)

So, the combination is now part of the
configuration of each FreeBSD that I use.

> this includes the following patch to vm_pageout.c that tijl@ shared with us:
> 
> diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
> index 36d5f327580..df827af3075 100644
> --- a/sys/vm/vm_pageout.c
> +++ b/sys/vm/vm_pageout.c
> @@ -1069,7 +1069,7 @@ vm_pageout_laundry_worker(void *arg)
>                 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;
>                 }

FYI: I restored the original code after doing the testing
for tijl@ .

> I have adjusted my behavior a little bit as well, since i do quite a bit of work in the AWS console in firefox I've been better at closing out all of those tabs when i'm not using them (their console is a serious memory hog).  i've also started using an official chrome binary inside an ubuntu jail which is where i run slack and discord, that seems to behave better as well in terms of memory utilization.
> 
> i am going to revert the vm_pageout.c patch today when i do my weekly rebuild of world to see how things go, maybe that'll give determine if its really the sysctl's helping or not.

===
Mark Millard
marklmi at yahoo.com