supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* s6 options
@ 2020-11-04 10:15 billa chaitanya
  2020-11-04 10:47 ` Oliver Schad
  0 siblings, 1 reply; 2+ messages in thread
From: billa chaitanya @ 2020-11-04 10:15 UTC (permalink / raw)
  To: supervision

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

Hi Team,
Is there any option available in s6 (like oom-kill-protect ) equivalent to
"OOMScoreAdjust" of systemd ?


Thanks,
Chaitanya

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: s6 options
  2020-11-04 10:15 s6 options billa chaitanya
@ 2020-11-04 10:47 ` Oliver Schad
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Schad @ 2020-11-04 10:47 UTC (permalink / raw)
  To: supervision

[-- 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
(https://www.kernel.org/doc/Documentation/filesystems/proc.txt):

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

-----------------------------------------------------------------------------
CHAPTER 3: PER-PROCESS PARAMETERS
------------------------------------------------------------------------------

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 <billachaitanya@gmail.com> 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
Geschäftsführer
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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-04 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 10:15 s6 options billa chaitanya
2020-11-04 10:47 ` Oliver Schad

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 http://inbox.vuxu.org/supervision

	# 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/ http://inbox.vuxu.org/supervision \
		subscribe@list.skarnet.org
	public-inbox-index supervision

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.supervision.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git