Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelisting a process by name #125

Open
D3vil0p3r opened this issue Dec 30, 2022 · 11 comments
Open

Whitelisting a process by name #125

D3vil0p3r opened this issue Dec 30, 2022 · 11 comments

Comments

@D3vil0p3r
Copy link

Hello,
I'm trying to whitelist a process to avoid that OOM nohang kills it. What I'm trying to whitelist is gnome-shell process, and for doing this, I edited /etc/nohang/nohang.conf and I added:

##  7.2.1. Matching process names with RE patterns to change their badness
##  Example:
#   @BADNESS_ADJ_RE_NAME 200 /// ^Web Content$
@BADNESS_ADJ_RE_NAME 0 /// ^gnome-shell$

but when I run a process that makes gnome-shell to use a lot of resources, by journalctl I'm still getting:

oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/[email protected]/session.slice/[email protected],task=gnome-shell,pid=47368,uid=1000
Out of memory: Killed process 47368 (gnome-shell) total-vm:4065984kB, anon-rss:136kB, file-rss:9228kB, shmem-rss:20kB, UID:1000 pgtables:1432kB oom_score_adj:200

and my user session restarts always.

How can I whitelist gnome-shell or a process by name in nohang?

@hakavlad
Copy link
Owner

Hi!

@BADNESS_ADJ_RE_NAME -900  /// ^gnome-shell$

should work.

Out of memory: Killed process 47368 (gnome-shell)

It looks like nohang didn't work at all - the kernel's OOM killer worked instead.

@D3vil0p3r
Copy link
Author

@hakavlad does nohang override kernel's OOM killer settings?

@hakavlad
Copy link
Owner

nohang should work earlier than kernel's OOMK.

@hakavlad
Copy link
Owner

Did you change something else in the config?

@hakavlad
Copy link
Owner

does nohang override kernel's OOM killer settings?

No. They work independently of each other.

@D3vil0p3r
Copy link
Author

does nohang override kernel's OOM killer settings?

No. They work independently of each other.

I think that the crash was caused nt by nohang but by kernel's OOM killer... In the config I didn't change other things.

@hakavlad
Copy link
Owner

Is the service running at all? What's in the status?

sudo systemctl status nohang
sudo systemctl status nohang-desktop

@hakavlad
Copy link
Owner

How much swap space do you have?

@hakavlad
Copy link
Owner

What's in the journal?
sudo journalctl -eu nohang
sudo journalctl -eu nohang-desktop

@D3vil0p3r
Copy link
Author

Is the service running at all? What's in the status?

sudo systemctl status nohang
sudo systemctl status nohang-desktop

Yes, the nohang service is running and active. I don't use nohang-desktop.

Swap Space: 8GB

About the journalctl -eu nohang:

Dec 30 22:20:00 penthost systemd[1]: Started Sophisticated low memory handler.
Dec 30 22:20:00 penthost nohang[1858]: Starting nohang with config /etc/nohang/nohang.conf
Dec 30 22:20:00 penthost nohang[1858]: Monitoring has started!
Dec 30 22:20:27 penthost systemd[1]: Stopping Sophisticated low memory handler...
Dec 30 22:20:27 penthost nohang[1858]: Got the SIGTERM signal
Dec 30 22:20:27 penthost nohang[1858]: No corrective actions applied in the last 26.5s
Dec 30 22:20:27 penthost nohang[1858]: Process time: 0.08s (average: 0.3%); exit.
Dec 30 22:20:27 penthost systemd[1]: nohang.service: Deactivated successfully.
Dec 30 22:20:27 penthost systemd[1]: Stopped Sophisticated low memory handler.
Dec 30 22:20:27 penthost systemd[1]: Started Sophisticated low memory handler.
Dec 30 22:20:27 penthost nohang[1998]: Starting nohang with config /etc/nohang/nohang.conf
Dec 30 22:20:27 penthost nohang[1998]: Monitoring has started!

For nohang-desktop no entries (because I use only nohang).

In your opinion, could be effective to disable the kernel's OOM killer and use only nohang? I set vm.overcommit_memory = 0 but it seems I'm still getting kill on gnome-shell. How can I disable the kernel's OOM killer and use only nohang?

@hakavlad
Copy link
Owner

hakavlad commented Jan 2, 2023

In your opinion, could be effective to disable the kernel's OOM killer

I'm not sure this is even possible. Do you have any idea how to do it?

btw, what kernel version are you using? Is MGLRU enabled?

I set vm.overcommit_memory = 0

It is default value typically. It does not turn off kernel's OOMK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants