Add support for oom_score_adj.
PATCH 1/1 Add support for oom_score_adj.
/proc/<pid>/oom_adj has been deprecated (kernel v2.6.36) due to the rework of the badness heuristic; oom_score_adj is the replacement. Keep a fallback to the old interface for compatibility with older kernels.
--- udev/udevd.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
udev/udevd.c +11 -4
@@ -1302,12 +1302,19 @@ int main(int argc, char *argv[])fclose (f); } -/* OOM_DISABLE = -17 */ - fd =open ("/proc/self/oom_adj" ,O_RDWR ); + fd =open ("/proc/self/oom_score_adj" ,O_RDWR );if (fd <0 ) { -err (udev,"error disabling OOM: %m\n" ); +/* Fallback to old interface */ + fd =open ("/proc/self/oom_adj" ,O_RDWR ); +if (fd <0 ) { +err (udev,"error disabling OOM: %m\n" ); + }else { +/* OOM_DISABLE = -17 */ +write (fd,"-17" ,3 ); +close (fd); + } }else { -write (fd,"-17" ,3 ); +write (fd,"-1000" ,5 );close (fd); }
Signature · 1 line
1.7.1
Hello Luca,
Luca Tettamanti [2010-08-23 14:35 +0200]:
Quoted 4 lines
/proc/<pid>/oom_adj has been deprecated (kernel v2.6.36) due to the rework of the badness heuristic;
oom_score_adjis the replacement. Keep a fallback to the old interface for compatibility with older kernels.
This corresponds to
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h¦3d83f427fbce97a6cea0db2e64b0eb8435cd10
I pushed that with that reference, thank you!
Martin
Signature · 2 lines
Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)