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

Questions about badness adjustments and oom-sort #115

Open
jamespharvey20 opened this issue Mar 24, 2021 · 1 comment
Open

Questions about badness adjustments and oom-sort #115

jamespharvey20 opened this issue Mar 24, 2021 · 1 comment

Comments

@jamespharvey20
Copy link

  1. With the kernel already using the term badness used to calculate the term oom_score, nohang's usage of the term badness confused me for a while. After examining the source and playing around with it a bit, I wonder if it might be better in nohang to drop the term "badness" completely. It seems to work as a oom_score_adj_adj which is kind of a weird name, so could maybe be called oom_score_adj_extra. It seems like it's added to the kernel's oom_score, without displacing the oom_score_adj that its adjusted by in the kernel.

  2. Through testing and viewing source, oom-sort shows the oom_score and oom_score_adj values as reported by the kernel, and isn't affected by and doesn't list separately the @BADNESS_ADJ_ conf file entries. This is actually where I started this journey, trying to debug regex's that turned out to be fine, because its output wasn't changing. :-) Could the oom-sort man page clarify it isn't affected by the conf file entries? (In retrospect, this makes sense, since there isn't a single /etc/ conf file for nohang, and it wasn't having me specify one.)

  3. Better yet, could oom-sort either be changed or given an option to parse the conf file and use the BADNESS_ADJ_ entries?

  4. This doesn't exactly fit here, but I'm assuming the systemd service needs to be restarted to reload conf file changes, and that during each cycle it doesn't check to see if the file has been updated. That could also be a nice addition to mention in the ongoing documentaiton project. Especially if someone views a nohang-calculated badness level like I am, if they were to miss this need, it wouldn't operate like they thought it would they rebooted.

In case it helps anyone, I'm using the following script to show me processes sorted in the order that nohang would kill them:

nohang-tasks

#!/usr/bin/bash

output_file="/tmp/nohang.$$"

sudo nohang --config /etc/nohang/nohang-desktop.conf --tasks > "${output_file}"

# print header
head -n 5 "${output_file}"
# print resorted table, everything between the lines starting #- and ## at the bottom (courtesy of konsolebox in irc #bash)
awk 'p && /^##/ { exit } p; /^#-/ { p = 1 }' "${output_file}" | \
   sort -k 4,4 -k 2,2 --reverse
# print footer
tail -n 4 "${output_file}"

rm "${output_file}"
@LennartSpitzner
Copy link

Fyi, afaict

awk 'p && /^##/ { exit } p; /^#-/ { p = 1 }' "${output_file}" | \
   sed -E 's/^#//' | \
   sort -n -k 3,3 -k 1,1 --reverse

does a better job. For long proc-ids you get output like #9081239 which is one column according to awk. So drop the '#' prefix. And sort -n seems more appropriate :)

I agree with the sentiment - would be nice if oom-sort would reflect the config-file settings somehow. Or clearly point out that it does not.

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