Re: Out-of-swap killer and SIGTERM signal

From: Peter Jeremy <peterj_at_freebsd.org>
Date: Wed, 12 Jan 2022 03:21:25 UTC
On 2022-Jan-10 12:55:56 +0000, ralph41096 <ralph41096@protonmail.com> wrote:
>Do you think it would be a good idea to introduce the following soft
>mode for the Out-of-swap killer?

There have been lots of discussions about this in the past, starting in
about 1998, (though I agree that it's been about 4 years since the last
discussion).  I suggest you search for "freebsd+sigdanger" for previous
discussions.

>New behaviour:
>  1) If there is less than 2 GiB of free swap space, send SIGTERM
>     signals to the condemned processes, then wait for a 5 seconds
>     grace period, then send SIGKILL signals to the condemned processes
>     who are still running.

2 GiB seems quite a high limit, especially with a 5s grace period.  That
implies the system is using swap at 410 MiB/s - which seems unrealistic.
It also means that you need to overprovision swap by 2 GiB since the last
2 GiB is effectively unusable.

>These two system-wide parameters (2 GiB of free swap space, 5 seconds
>grace period) could be defined in a configuration file, to allow the
>administrator to change them.

The FreeBSD model would be to make them sysctls.

-- 
Peter Jeremy