Skip to contentSkip to conversation

mm, oom: add comment for why oom_adj exists

PATCH Hillf Danton 1 participant 1 message Nov 6, 2015 Memory management

lore
Share & tools
lore

Hillf Danton

author Acked-by
#0 lore raw
Quoted 9 lines

/proc/pid/oom_adj exists solely to avoid breaking existing userspace binaries that write to the tunable.

Add a comment in the only possible location within the kernel tree to describe the situation and motivation for keeping it around.

---

Quoted 14 lines
 fs/proc/base.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
fs/proc/base.c +4 -0
@@ -1032,6 +1032,16 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
 	return simple_read_from_buffer(buf, count, ppos, buffer, len);
 }
 
+/*
+ * /proc/pid/oom_adj exists solely for backwards compatibility with previous
+ * kernels.  The effective policy is defined by oom_score_adj, which has a
+ * different scale: oom_adj grew exponentially and oom_score_adj grows linearly.

fs/proc/base.c static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,

Quoted 10 lines
fs/proc/base.c +6 -1
+ * Values written to oom_adj are simply mapped linearly to oom_score_adj.
+ * Processes that become oom disabled via oom_adj will still be oom disabled
+ * with this implementation.
+ *
+ * oom_adj cannot be removed since existing userspace binaries use it.
+ */
 static ssize_t oom_adj_write(struct file *file, const char __user *buf,
 			     size_t count, loff_t *ppos)
 {
--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>