Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1273503ybt; Thu, 9 Jul 2020 03:02:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywLvhgyiX0UwaNCerImFVPbfXrNUPguKOuBxJOv+TbvN8QOyra9VSQLKT7h72YtrDrtvbf X-Received: by 2002:a50:fa07:: with SMTP id b7mr69516623edq.298.1594288957659; Thu, 09 Jul 2020 03:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594288957; cv=none; d=google.com; s=arc-20160816; b=KA7DBLr9bdQVQjLjXNTyv5gUzj1gOzp0LUEj3g486o6oarPpcxxFF1mSscgGreh8PT MbALhlAtEiCvyad48XR6igBeFvRvac4HP2hwaFSwtElL6udNxnX7HM8j+jlJMNxJ4Z94 3BvAn2dWLlNmmBmU8lXbmVYs86xbQLDSjAzQrbEBBl/un51voJ1tcF3hYLNyx3GaVq7z yzwUH4uQkfqElotrPHL1tJJP03jCn0llGGORekvD4xHUUqbIARYamt8b7ZJLxbm2E0hC GsPPJW6e/I9YUAbC0eG4i7GizH14VN1/c7VdDQu29cR8NCsnM4UfUXnRFFnp1iYHGP/U JCxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=fcVd+42gAsaDsTUC8Mwb0seStM1wcCxxRuSbi3ul/6g=; b=E+EYyUg4xcVGzFqf1oxrkHWAfom3+E8PsGcfCNOunPjxFZkqheJ3TPvpKPOmyZ1dzY H/+p8AT43cpdrtLEE+trZh5Fu+cmqcdhy4eC0q5zEg1CrLsDkdpbTGddozbml3XOR9BL toUyps+o1cmKneqTjQDKEeNTnZm+TOqwVeh5ShoAAyPi6nQG6nlfNX2gOZlK+51CYbz0 SskUyLLRI3xgISaCTH43XeEiGKqsxbwLzZk5TeQ2dMEWXHI2az2wY3JLBfbvU+DHuz09 uMi8w1cVm8YuKNnMZ3B+9kbvacnk5vtZdeVm2WmrsmTVi5vz2ELYEFj3O/Jck/Q/Idlh SS9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc14si1593643edb.368.2020.07.09.03.02.14; Thu, 09 Jul 2020 03:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgGIJ6q (ORCPT + 99 others); Thu, 9 Jul 2020 05:58:46 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33857 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbgGIJ6p (ORCPT ); Thu, 9 Jul 2020 05:58:45 -0400 Received: by mail-wr1-f65.google.com with SMTP id f7so1703714wrw.1 for ; Thu, 09 Jul 2020 02:58:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fcVd+42gAsaDsTUC8Mwb0seStM1wcCxxRuSbi3ul/6g=; b=adpmt9aiFe9FVgaoMmEUMBSLSe2lC7n8/rlOzCtnH9YaGd6bi+T7KwX2cEhawHGczJ uC4Q4kzjgFuS2soC8v4FMoyCph3RCaCwyhEH1LrZJhzq8zXYKWGZ3+Zvm5+75gpE3mon PNicW+UqIaTTFhlSj0imgLwfQW+PGMXZQ7ctTea/DITH334GQ3VPixjWdw5OCTSU6cPR tQJlnbrcCqZTzXuzK7wFRbXQVDJ8YqSGC0KvyutgzZDb+DUA514pjG1VFjH2uXMXsiVW 2EzdeKNC/EPyAiYGPYJbB1TUyDdP0mZ8e+WnxDUKlAjjnwsNdtVhDnjnVdw1BKAx3lDt jVag== X-Gm-Message-State: AOAM533cy45Phj6F7gcY35zQ6PMYHVxffWCeBgVxQwCipKFKR6OwuvhQ 1nZ1xVq3WRFT2K33d8hX9x0cZwkW X-Received: by 2002:adf:f203:: with SMTP id p3mr34446609wro.331.1594288722906; Thu, 09 Jul 2020 02:58:42 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id w2sm4561772wrs.77.2020.07.09.02.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 02:58:42 -0700 (PDT) Date: Thu, 9 Jul 2020 11:58:40 +0200 From: Michal Hocko To: Yafang Shao Cc: Jonathan Corbet , Andrew Morton , David Rientjes , Linux MM , LKML Subject: Re: [PATCH 2/2] doc, mm: clarify /proc//oom_score value range Message-ID: <20200709095840.GE19160@dhcp22.suse.cz> References: <20200709062603.18480-1-mhocko@kernel.org> <20200709062603.18480-2-mhocko@kernel.org> <20200709081813.GD19160@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 09-07-20 17:01:06, Yafang Shao wrote: > On Thu, Jul 9, 2020 at 4:18 PM Michal Hocko wrote: > > > > On Thu 09-07-20 15:41:11, Yafang Shao wrote: > > > On Thu, Jul 9, 2020 at 2:26 PM Michal Hocko wrote: > > > > > > > > From: Michal Hocko > > > > > > > > The exported value includes oom_score_adj so the range is no [0, 1000] > > > > as described in the previous section but rather [0, 2000]. Mention that > > > > fact explicitly. > > > > > > > > Signed-off-by: Michal Hocko > > > > --- > > > > Documentation/filesystems/proc.rst | 3 +++ > > > > 1 file changed, 3 insertions(+) > > > > > > > > diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst > > > > index 8e3b5dffcfa8..78a0dec323a3 100644 > > > > --- a/Documentation/filesystems/proc.rst > > > > +++ b/Documentation/filesystems/proc.rst > > > > @@ -1673,6 +1673,9 @@ requires CAP_SYS_RESOURCE. > > > > 3.2 /proc//oom_score - Display current oom-killer score > > > > ------------------------------------------------------------- > > > > > > > > +Please note that the exported value includes oom_score_adj so it is effectively > > > > +in range [0,2000]. > > > > + > > > > > > [0, 2000] may be not a proper range, see my reply in another thread.[1] > > > As this value hasn't been documented before and nobody notices that, I > > > think there might be no user really care about it before. > > > So we should discuss the proper range if we really think the user will > > > care about this value. > > > > Even if we decide the range should change, I do not really assume this > > will happen, it is good to have the existing behavior clarified. > > > > But the existing behavior is not defined in the kernel documentation > before, so I don't think that the user has a clear understanding of > the existing behavior. Well, documentation is by no means authoritative, especially when it is outdated or incomplete. What really matters is the observed behavior and a lot of userspace depends on that or based on the specific implementation. > The way to use the result of proc_oom_score is to compare which > processes will be killed first by the OOM killer, IOW, the user should > always use it to compare different processes. For example, > > if proc_oom_score(process_a) > proc_oom_score(process_b) > then > process_a will be killed before process_b > fi > > And then the user will "Use it together with > /proc//oom_score_adj to tune which > process should be killed in an out-of-memory situation." > > That means what the user really cares about is the relative value, and > they will not care about the range or the absolute value. In an ideal world yes. But the real life tells a different story. Many times userspace (ab)uses certain undocumented/unintended (mis)features and the hard rule is that we never break userspace. We've learned that through many painful historical experiences. Especially vaguely defined functionality suffers from the problem. -- Michal Hocko SUSE Labs