From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27664 invoked from network); 4 Nov 2020 10:47:28 -0000 Received: from alyss.skarnet.org (95.142.172.232) by inbox.vuxu.org with ESMTPUTF8; 4 Nov 2020 10:47:28 -0000 Received: (qmail 21878 invoked by uid 89); 4 Nov 2020 10:47:48 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Received: (qmail 21871 invoked from network); 4 Nov 2020 10:47:48 -0000 Date: Wed, 4 Nov 2020 11:47:14 +0100 From: Oliver Schad To: supervision@list.skarnet.org Subject: Re: s6 options Message-ID: <20201104114714.0b7f8d7c@flunder> In-Reply-To: References: Organization: Automatic Server AG X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/3gOp7He=kkn8Nw_SDQIYnAp"; protocol="application/pgp-signature" --Sig_/3gOp7He=kkn8Nw_SDQIYnAp Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Chaitanya s6 is not build to mirror all kernel interfaces for process management. This stuff is heavily system dependent and it makes to real sense to just copy a kernel interface to a s6 option, which just works on Linux. So the right way is to put that into the run script of your service - it's just an echo to the /proc hierarchy, in concrete /proc/self/oom_score_adj. It's that easy. Look at the Linux kernel documentation, how to handle that in detail (https://www.kernel.org/doc/Documentation/filesystems/proc.txt): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snip =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ---------------------------------------------------------------------------= -- CHAPTER 3: PER-PROCESS PARAMETERS ---------------------------------------------------------------------------= --- 3.1 /proc//oom_adj & /proc//oom_score_adj- Adjust the oom-killer = score ---------------------------------------------------------------------------= ----- These file can be used to adjust the badness heuristic used to select which process gets killed in out of memory conditions. The badness heuristic assigns a value to each candidate task ranging from 0 (never kill) to 1000 (always kill) to determine which process is targeted. = The units are roughly a proportion along that range of allowed memory the proce= ss may allocate from based on an estimation of its current memory and swap use. For example, if a task is using all allowed memory, its badness score will = be 1000. If it is using half of its allowed memory, its score will be 500. There is an additional factor included in the badness score: the current me= mory and swap usage is discounted by 3% for root processes. The amount of "allowed" memory depends on the context in which the oom kill= er was called. If it is due to the memory assigned to the allocating task's c= puset being exhausted, the allowed memory represents the set of mems assigned to = that cpuset. If it is due to a mempolicy's node(s) being exhausted, the allowed memory represents the set of mempolicy nodes. If it is due to a memory limit (or swap limit) being reached, the allowed memory is that configured limit. Finally, if it is due to the entire system being out of memory, the allowed memory represents all allocatable resources. The value of /proc//oom_score_adj is added to the badness score before= it is used to determine which task to kill. Acceptable values range from -1000 (OOM_SCORE_ADJ_MIN) to +1000 (OOM_SCORE_ADJ_MAX). This allows userspace to polarize the preference for oom killing either by always preferring a certa= in task or completely disabling it. The lowest possible value, -1000, is equivalent to disabling oom killing entirely for that task since it will al= ways report a badness score of 0. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D snap =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D On Wed, 4 Nov 2020 15:45:19 +0530 billa chaitanya wrote: > Hi Team, > Is there any option available in s6 (like oom-kill-protect ) > equivalent to "OOMScoreAdjust" of systemd ? >=20 >=20 > Thanks, > Chaitanya --=20 Automatic-Server AG =E2=80=A2=E2=80=A2=E2=80=A2=E2=80=A2=E2=80=A2 Oliver Schad Gesch=C3=A4ftsf=C3=BChrer Turnerstrasse 2 9000 St. Gallen | Schweiz www.automatic-server.com | oliver.schad@automatic-server.com Tel: +41 71 511 31 11 | Mobile: +41 76 330 03 47 --Sig_/3gOp7He=kkn8Nw_SDQIYnAp Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl+ihrIACgkQRilxUUuWlvAy4wCfYfFYzrlk9vqFu7cvw6hweHPs 8nYAn1UC+lt2XeQbv0o2tDoc1YN5OldC =fwYm -----END PGP SIGNATURE----- --Sig_/3gOp7He=kkn8Nw_SDQIYnAp--