supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Oliver Schad <>
Subject: Re: s6 options
Date: Wed, 4 Nov 2020 11:47:14 +0100
Message-ID: <20201104114714.0b7f8d7c@flunder> (raw)
In-Reply-To: <>

[-- Attachment #1: Type: text/plain, Size: 3346 bytes --]

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

=================== snip ====================


3.1 /proc/<pid>/oom_adj & /proc/<pid>/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 process
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 memory
and swap usage is discounted by 3% for root processes.

The amount of "allowed" memory depends on the context in which the oom killer
was called.  If it is due to the memory assigned to the allocating task's cpuset
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/<pid>/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 certain
task or completely disabling it.  The lowest possible value, -1000, is
equivalent to disabling oom killing entirely for that task since it will always
report a badness score of 0.

========================== snap ====================================

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 ?
> Thanks,
> Chaitanya

Automatic-Server AG •••••
Oliver Schad
Turnerstrasse 2
9000 St. Gallen | Schweiz |
Tel: +41 71 511 31 11 | Mobile: +41 76 330 03 47

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

      reply	other threads:[~2020-11-04 10:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 10:15 billa chaitanya
2020-11-04 10:47 ` Oliver Schad [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104114714.0b7f8d7c@flunder \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit

This inbox may be cloned and mirrored by anyone:

	git clone --mirror

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 supervision supervision/ \
	public-inbox-index supervision

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone