From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5077BC433E0 for ; Thu, 9 Jul 2020 09:58:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EBF4320708 for ; Thu, 9 Jul 2020 09:58:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EBF4320708 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 158566B0007; Thu, 9 Jul 2020 05:58:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 109CD6B0008; Thu, 9 Jul 2020 05:58:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01EC66B000A; Thu, 9 Jul 2020 05:58:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0197.hostedemail.com [216.40.44.197]) by kanga.kvack.org (Postfix) with ESMTP id E1A016B0007 for ; Thu, 9 Jul 2020 05:58:44 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 94EB48E78 for ; Thu, 9 Jul 2020 09:58:44 +0000 (UTC) X-FDA: 77018088168.18.pie90_580c39e26ec4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 64E56100ED9DC for ; Thu, 9 Jul 2020 09:58:44 +0000 (UTC) X-HE-Tag: pie90_580c39e26ec4 X-Filterd-Recvd-Size: 5734 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 09:58:43 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id z15so1666021wrl.8 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=Qd2LIQTsW1Y3f76k2WAkSI86FElVfw1BFHFg9ByONKpD4w84aFN1iIZKAlCJTaIWnm 39QDbgSTYjC+WxGG3cY6nvmJYwjl1Dr90Z+e4y+3vf0m6D0CQPV9/qBc6tY6diROl5JD rHzfW56MGpegSpEeLCfVXstVMmMR78QjEQ9r/UAy/lRFO4MQ1dcYNkTHe4Bgq64esinl K1ayzLBfenEiCPlNC9GSTPSod7fTFFrWVqdEIvkEw3lDVyoHl1+sRLWmn2CARm5ghUfT 5iWDgOmk26XL6KaZmfE51FeoAo5xEGUM+gGUKhS1ygMnisUOMz1jKLmhVyRnG3b/yuPe qMtg== X-Gm-Message-State: AOAM532zyjnwvPFCwns6HNd9KsovyRK9g1X3eiDFA5CPiuLMqhjv8UDK HFHV6Ydq0P4+oz2kPeuP9/c= X-Google-Smtp-Source: ABdhPJzM3UrFs4U+vl/cLoZYR//qWmynuQIsdFV0QyHjo9IzrXkZPtSsmE1OrFRQ0GjCDmtVodE2Ug== 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: X-Rspamd-Queue-Id: 64E56100ED9DC X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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