[patch -mm 6/9 v2] oom: deprecate oom_adj tunable

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Rientjes
Date: Monday, February 15, 2010 - 3:20 pm

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

Signed-off-by: David Rientjes <rientjes@google.com>
---
 Documentation/feature-removal-schedule.txt |   30 ++++++++++++++++++++++++++++
 Documentation/filesystems/proc.txt         |    3 ++
 fs/proc/base.c                             |    8 +++++++
 include/linux/oom.h                        |    3 ++
 4 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -168,6 +168,36 @@ Who:	Eric Biederman <ebiederm@xmission.com>
 
 ---------------------------
 
+What:	/proc/<pid>/oom_adj
+When:	December 2011
+Why:	/proc/<pid>/oom_adj allows userspace to influence the oom killer's
+	badness heuristic used to determine which task to kill when the kernel
+	is out of memory.
+
+	The badness heuristic has since been rewritten since the introduction of
+	this tunable such that its meaning is deprecated.  The value was
+	implemented as a bitshift on a score generated by the badness()
+	function that did not have any precise units of measure.  With the
+	rewrite, the score is given as a proportion of available memory to the
+	task allocating pages, so using a bitshift which grows the score
+	exponentially is, thus, impossible to tune with fine granularity.
+
+	A much more powerful interface, /proc/<pid>/oom_score_adj, was
+	introduced with the oom killer rewrite that allows users to increase or
+	decrease the badness() score linearly.  This interface will replace
+	/proc/<pid>/oom_adj.
+
+	See Documentation/filesystems/proc.txt for information on how to use the
+	new tunable.
+
+	A warning will be emitted to the kernel log if an application uses this
+	deprecated interface.  After it is printed once, future warning will be
+	suppressed until the kernel is rebooted.
+
+Who:	David Rientjes <rientjes@google.com>
+
+---------------------------
+
 What:	remove EXPORT_SYMBOL(kernel_thread)
 When:	August 2006
 Files:	arch/*/kernel/*_ksyms.c
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1247,6 +1247,9 @@ scaled linearly with /proc/<pid>/oom_score_adj.
 Writing to /proc/<pid>/oom_score_adj or /proc/<pid>/oom_adj will change the
 other with its scaled value.
 
+NOTICE: /proc/<pid>/oom_adj is deprecated and will be removed, please see
+Documentation/feature-removal-schedule.txt.
+
 Caveat: when a parent task is selected, the oom killer will sacrifice any first
 generation children with seperate address spaces instead, if possible.  This
 avoids servers and important system daemons from being killed and loses the
diff --git a/fs/proc/base.c b/fs/proc/base.c
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1157,6 +1157,14 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
 		return -EACCES;
 	}
 
+	/*
+	 * Warn that /proc/pid/oom_adj is deprecated, see
+	 * Documentation/feature-removal-schedule.txt.
+	 */
+	printk_once(KERN_WARNING "%s (%d): /proc/%d/oom_adj is deprecated, "
+			"please use /proc/%d/oom_score_adj instead.\n",
+			current->comm, task_pid_nr(current),
+			task_pid_nr(task), task_pid_nr(task));
 	task->signal->oom_adj = oom_adjust;
 	/*
 	 * Scale /proc/pid/oom_score_adj appropriately ensuring that a maximum
diff --git a/include/linux/oom.h b/include/linux/oom.h
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -2,6 +2,9 @@
 #define __INCLUDE_LINUX_OOM_H
 
 /*
+ * /proc/<pid>/oom_adj is deprecated, see
+ * Documentation/feature-removal-schedule.txt.
+ *
  * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
  */
 #define OOM_DISABLE (-17)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch -mm 0/9 v2] oom killer rewrite, David Rientjes, (Mon Feb 15, 3:19 pm)
[patch -mm 5/9 v2] oom: badness heuristic rewrite, David Rientjes, (Mon Feb 15, 3:20 pm)
[patch -mm 6/9 v2] oom: deprecate oom_adj tunable, David Rientjes, (Mon Feb 15, 3:20 pm)
[patch -mm 7/9 v2] oom: replace sysctls with quick mode, David Rientjes, (Mon Feb 15, 3:20 pm)
Re: [patch -mm 6/9 v2] oom: deprecate oom_adj tunable, David Rientjes, (Mon Feb 15, 3:35 pm)
Re: [patch -mm 8/9 v2] oom: avoid oom killer for lowmem al ..., KAMEZAWA Hiroyuki, (Mon Feb 15, 4:57 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Mon Feb 15, 5:00 pm)
Re: [patch -mm 8/9 v2] oom: avoid oom killer for lowmem al ..., KAMEZAWA Hiroyuki, (Mon Feb 15, 5:21 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Mon Feb 15, 5:23 pm)
[patch] mm: add comment about deprecation of __GFP_NOFAIL, David Rientjes, (Mon Feb 15, 6:13 pm)
Re: [patch] mm: add comment about deprecation of __GFP_NOFAIL, KAMEZAWA Hiroyuki, (Mon Feb 15, 6:26 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 1:10 am)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 4:42 pm)
Re: [patch -mm 8/9 v2] oom: avoid oom killer for lowmem al ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 4:48 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 5:01 pm)
Re: [patch -mm 8/9 v2] oom: avoid oom killer for lowmem al ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 5:03 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 5:41 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 6:03 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 7:13 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 7:23 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 7:34 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Tue Feb 16, 8:21 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., Daisuke Nishimura, (Sun Feb 21, 10:31 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Sun Feb 21, 11:15 pm)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., Daisuke Nishimura, (Mon Feb 22, 4:42 am)
Re: [patch -mm 4/9 v2] oom: remove compulsory panic_on_oom ..., KAMEZAWA Hiroyuki, (Mon Feb 22, 4:51 pm)