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

Rethinking -i option #248

Closed
hakavlad opened this issue May 10, 2021 · 4 comments
Closed

Rethinking -i option #248

hakavlad opened this issue May 10, 2021 · 4 comments

Comments

@hakavlad
Copy link
Contributor

hakavlad commented May 10, 2021

You may fix -i option instead of removing it.

Look at #234 (comment)

@hakavlad
Copy link
Contributor Author

hakavlad commented May 10, 2021

Other way:

  • do not change -i option to allow it to work with old kernels;
  • add the new (fixed) option (-I?) to work with new kernels (5.9+).

@hakavlad
Copy link
Contributor Author

hakavlad commented May 10, 2021

see also

	/*
	 * Special case OOM_SCORE_ADJ_MIN for all others scale the
	 * badness value into [0, 2000] range which we have been
	 * exporting for a long time so userspace might depend on it.
	 */
	if (badness != LONG_MIN)
		points = (1000 + badness * 1000 / (long)totalpages) * 2 / 3;

@hakavlad
Copy link
Contributor Author

compare (5.8 vs 5.9)

	points = oom_badness(task, totalpages) * 1000 / totalpages;

https://github.com/torvalds/linux/blob/v5.8/fs/proc/base.c#L555

	if (badness != LONG_MIN)
		points = (1000 + badness * 1000 / (long)totalpages) * 2 / 3;

https://github.com/torvalds/linux/blob/v5.9/fs/proc/base.c#L562

@rfjakob
Copy link
Owner

rfjakob commented May 10, 2021

I think to keep this option, it should work well with both new & old kernels ( as explained in 7ebc455 ). This means you need kernel version detection. And I'm not sure anybody but me even uses the -i flag.

@rfjakob rfjakob closed this as completed Apr 9, 2024
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