OOM killer like configuration?

fluca1978

Aspiring Daemon

Reaction score: 71
Messages: 761

Hi all,
I'm not able to find out if FreeBSD has something like the Linux OOM Killer, and in the case, what is the behavior and the settings. Anyone can please point me in the right direction?
 

mtu

Member

Reaction score: 21
Messages: 27

See here, especially the subsection titled "Why is the kernel killing my processes?":
 
OP
fluca1978

fluca1978

Aspiring Daemon

Reaction score: 71
Messages: 761

See here, especially the subsection titled "Why is the kernel killing my processes?":
Very interesting, thanks.
One question: how I can get information about a running process that has been protected?
I mean, I cannot find any flag in ps, any other tool?

edit: even procstat within the memory section does show different flags with or without protect in place, at least I'm not able to see the differences.
 

mtu

Member

Reaction score: 21
Messages: 27

One question: how I can get information about a running process that has been protected?
I mean, I cannot find any flag in ps, any other tool?

ps(1) can show you all sorts of "flags" associated with a process. From the manpage:

flags The flags associated with the process as in the include file <sys/proc.h>:
[…]
P_PROTECTED 0x100000 Do not kill on memory overcommit
P_SIGEVENT 0x200000 Process pending signals changed
P_SINGLE_BOUNDARY 0x400000 Threads should suspend at user boundary
P_HWPMC 0x800000 Process is using HWPMCs
[…]


When you run ps ux -o flags, you'll see those flags at the end of each line. If I'm reading the manpage correctly, then a process is protected when a 1 (or any odd number?) appears as the third digit from the left in that column.

On a server of mine, that gives me syslog, sshd and cron as protected (and nothing else), which makes sense (emphasis mine):

root 406 0.0 0.0 12556 3664 - Is Tue19 0:00.02 /usr/sbin/mountd 10000000
root 497 0.0 0.0 6416 1636 - Ss 18Mar21 0:22.97 /usr/sbin/syslog 10100000
root 620 0.0 0.0 6372 1072 - Ss 18Mar21 3:51.92 /usr/sbin/powerd 10000000
root 672 0.0 0.0 12856 2396 - Ss 18Mar21 0:00.33 /usr/sbin/sshd 10100100
root 699 0.0 0.0 6456 776 - Is 18Mar21 0:08.26 /usr/sbin/cron - 10100000
root 766 0.0 0.0 0 16 - DL 18Mar21 14:33.93 [g_eli[0] gpt/ha 10000204
 

Mjölnir

Daemon

Reaction score: 1,463
Messages: 2,114

You may want to consider to subscribe to (and/or read the archive of) the <freebsd-hackers> mailing list. IIUC s/o is currently working on that to improve the OOM-killer.
 
Top