Personal tools
You are here: Home Issue tracker S38zfs-fuse (1142): /proc/1163/oom_adj is deprecated, please use /proc/1163/oom_score_adj instead.

#116 — S38zfs-fuse (1142): /proc/1163/oom_adj is deprecated, please use /proc/1163/oom_score_adj instead.

State Resolved
Version: 0.6.9
Area Process
Issue type Patch
Severity Medium
Submitted by (anonymous)
Submitted on Jan 28, 2011
Responsible Seth Heeren
Target release: 0.7.0
Return to tracker
Last modified on Feb 01, 2012 by Seth Heeren
dmesg reports:

[ 38.447245] cfg80211: Found new beacon on frequency: 2472 MHz (Ch 13) on phy0
[ 38.606987] S38zfs-fuse (1142): /proc/1163/oom_adj is deprecated, please use /proc/1163/oom_score_adj instead.
[ 40.940789] IPv6 over IPv4 tunneling driver

Solution is:


$ diff -u /etc/init.d/zfs-fuse.orig /etc/init.d/zfs-fuse
--- /etc/init.d/zfs-fuse.orig 2011-01-28 21:20:55.725397214 +0100
+++ /etc/init.d/zfs-fuse 2011-01-28 21:21:25.865931918 +0100
@@ -139,7 +139,7 @@
     then
         log_end_msg 0
         log_action_begin_msg "Immunizing $NAME against OOM kills and sendsigs signals"
- echo -17 > /proc/$(cat /var/run/$NAME.pid)/oom_adj
+ echo -17 > /proc/$(cat /var/run/$NAME.pid)/oom_score_adj
         ES_TO_REPORT=$?
         if [ "$ES_TO_REPORT" = 0 ] ; then
           log_action_end_msg 0
Added by (anonymous) on Jan 28, 2011 04:27 PM
oops, typo:


--- /etc/init.d/zfs-fuse.orig 2011-01-28 21:20:55.725397214 +0100
+++ /etc/init.d/zfs-fuse 2011-01-28 21:26:32.680999665 +0100
@@ -139,7 +139,7 @@
     then
         log_end_msg 0
         log_action_begin_msg "Immunizing $NAME against OOM kills and sendsigs signals"
- echo -17 > /proc/$(cat /var/run/$NAME.pid)/oom_adj
+ echo -1000 > /proc/$(cat /var/run/$NAME.pid)/oom_score_adj
         ES_TO_REPORT=$?
         if [ "$ES_TO_REPORT" = 0 ] ; then
           log_action_end_msg 0

According to the docs:

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). This allows userspace to
polarize the preference for oom killing either by always preferring a certain
task or completely disabling it. The lowest possible value, -1000, is
equivalent to disabling oom killing entirely for that task since it will always
report a badness score of 0.
Added by Seth Heeren on Jan 28, 2011 09:29 PM
Thanks for the info

On what platforms is this? Is this kernel version specific or distribution specific? I'm trying to establish what initscripts are affected, and since you don't mention your distribution/version I'm having to guess :)
Added by (anonymous) on Jan 29, 2011 12:14 PM
This is kernel specific - the OOM killer changed in 2.6.36 (see http://lkml.org/lkml/2010/2/15/322)

/proc/pid/oom_adj is now deprecated so that that it may eventually be
removed. The target date for removal is December 2011.

A warning will be printed to the kernel log if a task attempts to use
this interface. Future warning will be suppressed until the kernel is
rebooted to prevent spamming the kernel log.

I'm on Ubuntu 10.10
Added by Seth Heeren on Jan 29, 2011 04:36 PM
Ok thanks for the pointers. It isn't exactly clear to me, what versions of kernels first started supporting the new variant. Depending on that, we might have to stick to the old interface to avoid dropping users behind.

A git log -Soom_score_adj linus/master told me the following bits: it was introduced in v2.6.36, has a 2-year deprecation period, and at least ubuntu seems to have this in it's LTS kernel line since 2.6.37

$ git describe a63d83f42
v2.6.35-5872-ga63d83f

$ git tag --contains a63d83f42 | sort | head -3
Ubuntu-lts-2.6.37-6.17
Ubuntu-lts-2.6.38-1.27
v2.6.36

Log output:
Date: Mon Aug 9 17:19:47 2010 -0700
    /proc/pid/oom_adj is now deprecated so that that it may eventually be
    removed. The target date for removal is August 2012

commit a63d83f427fbce97a6cea0db2e64b0eb8435cd10
Date: Mon Aug 9 17:19:46 2010 -0700
    oom: badness heuristic rewrite
    /proc/pid/oom_adj is changed so that its meaning is rescaled into the
    units used by /proc/pid/oom_score_adj, and vice versa. ...
Added by (anonymous) on Jan 29, 2011 04:59 PM
Maybe one could simply check if the new proc entry exists and use that, and if not use the old one. That should be safe.
Added by (anonymous) on Jan 31, 2011 07:24 AM
Also refer to active discussion here

http://groups.google.com/[…]/6591c56cda029a6
Added by Tim Radke on Feb 01, 2012 04:40 AM
According to https://bugzilla.mindrot.org/show_bug.cgi?id=1838 oom_score_adj should be set to -1000 to get the same behavior as oom_adj set to -17.
Added by Tim Radke on Feb 01, 2012 04:55 AM
if [ -f "/proc/$PID/oom_score_adj" ]
then
echo -1000 > "/proc/$PID/oom_score_adj"
else
echo -17 > "/proc/$PID/oom_adj"
fi
Added by Seth Heeren on Feb 01, 2012 05:57 AM
Issue state: unconfirmedresolved
Target release: None0.7.0
Responsible manager: (UNASSIGNED)sgheeren
Thanks Tim!

things are not always very complicated but the help is very much appreciated. I had never come round to it; The upstart script has been using `oom never` forever:

    https://github.com/[…]/zfs.upstart

I have tested this and updated the relevant initscripts under contrib/ and will notify the list on the linked thread.

See your credits:

http://gitweb.zfs-fuse.net/[…]3a1e66f49990ce3523bc9f0a31e