Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965164AbbKEV22 (ORCPT ); Thu, 5 Nov 2015 16:28:28 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35883 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965081AbbKEV20 (ORCPT ); Thu, 5 Nov 2015 16:28:26 -0500 Date: Thu, 5 Nov 2015 13:28:24 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Michal Hocko cc: Andrew Morton , =?UTF-8?Q?Hongjie_Fang_=28=E6=96=B9=E6=B4=AA=E6=9D=B0=29?= , "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: Re: [patch] mm, oom: add comment for why oom_adj exists In-Reply-To: <20151105102840.GA15111@dhcp22.suse.cz> Message-ID: References: <20151105102840.GA15111@dhcp22.suse.cz> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1909 Lines: 39 On Thu, 5 Nov 2015, Michal Hocko wrote: > > diff --git a/fs/proc/base.c b/fs/proc/base.c > > --- a/fs/proc/base.c > > +++ b/fs/proc/base.c > > @@ -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. > > + * 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. > > This is a bit strong wording. I think the knob can be removed in the future. > Perhaps you are my optimistic than I am, but I would think it would be difficult to remove a tunable that requires binaries to be re-built to avoid. That was Linus's primary objection, IIRC. If an application fails to oom disable itself because it still writes to oom_adj, the results could be a system wide failure. There are workarounds to that if you have root, but I don't think we're in a position to remove it in the near future. I think the comment is clear why it cannot be removed right now and its current implementation. Converting software that writes to oom_adj to use oom_score_adj instead is still a worthwhile goal, though, since they'd be using the semantics of the effective policy. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/