Skip to content

Adds Process::oom_score_adj#139

Closed
vrmiguel wants to merge 1 commit intoeminence:masterfrom
vrmiguel:oom_score_adj
Closed

Adds Process::oom_score_adj#139
vrmiguel wants to merge 1 commit intoeminence:masterfrom
vrmiguel:oom_score_adj

Conversation

@vrmiguel
Copy link

Hey there!

This PR adds oom_score_adj to Process.
I don't know the minimum Linux version that has this property, though.

If merged, I plan to use this function during the testing of a small OOM killer of my own, bustd :D

Copy link
Owner

@eminence eminence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! 👋

Sorry it took so long to review this PR, it totally fell off my radar until now.

I'm reading the documentation on oom_score_adj, and it's a little confusing. But it says this:

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).

So the way I read this is: while the final OOM "score" will be somewhere between 0 and 1000, the value reported in oom_score_adj can be between -1000 and 1000. So I think the oom_score_adj function should return a i16 not u32.

Also, you could please tweak the doc string slightly:

  • Put a new line after a short description of the function (then can come the full function description)
  • Add "(since Linux 2.6.36)" at the very end of the doc string

Thanks!

@eminence
Copy link
Owner

eminence commented Nov 6, 2021

Hi @vrmiguel

Just checking in to see if you still if you're able to make the requested change. If not, that's no problem at all, I can make it myself. Thanks!

This pull request was closed.
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.

2 participants