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

[oom] Fix OOMScoreAdjust crashes from other user services. #10

Merged
merged 1 commit into from Oct 28, 2014

Conversation

locusf
Copy link
Member

@locusf locusf commented Oct 28, 2014

No description provided.

@faenil
Copy link
Member

faenil commented Oct 28, 2014

lgtm, even though we still don't know why this is needed....@stskeeps?

locusf added a commit that referenced this pull request Oct 28, 2014
[oom] Fix OOMScoreAdjust crashes from other user services.
@locusf locusf merged commit 80ea7f4 into nemomobile:master Oct 28, 2014
@hedayat
Copy link
Contributor

hedayat commented Oct 29, 2014

Hmmm... it seems that an unprivileged process (systemd --user) can't adjust this value for its children to something lower than its own OOMScoreAdjust value (0 by default). So, this is needed so that OOMScoreAdjust value for user services can be below zero. With this commit, user services can have OOMScoreAdjust value between -750 and 1000. If values lower than -750 is needed, you should decrees this value for user@.service too.

@faenil
Copy link
Member

faenil commented Oct 29, 2014

great thanks! where did you find the info?

Edit: I found "The value of /proc//oom_score_adj may be reduced no lower than the last
value set by a CAP_SYS_RESOURCE process. To reduce the value any lower
requires CAP_SYS_RESOURCE." from https://www.kernel.org/doc/Documentation/filesystems/proc.txt

@hedayat
Copy link
Contributor

hedayat commented Oct 29, 2014

Yes, the info was from initial guess, 'man proc' (almost same as proc.txt), and some tests. However, when I was thinking about answering you, I found that we have a problem which should be fixed:
"a new process inherits its parent's oom_adj setting." (found in man proc)

This means that since we run 'systemd --user' with OOMScoreAdjust=-750, all user services have this score by default. So, while some services got -250 score to make them less likely to be killed in OOM situations (at least this is what I guess, right?), now they are actually the first user services which might be killed because all other user services are running with -750 score adjust value!

Therefore, I think we should add "OOMScoreAdjust=0" for all other user services.

@faenil
Copy link
Member

faenil commented Oct 30, 2014

mm well spotted, I guess this makes sense

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

Successfully merging this pull request may close these issues.

None yet

3 participants