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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 F3BE0C433E0 for ; Thu, 9 Jul 2020 11:20:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B420C206DF for ; Thu, 9 Jul 2020 11:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m72c9lmd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B420C206DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1131A6B0005; Thu, 9 Jul 2020 07:20:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C45F6B0006; Thu, 9 Jul 2020 07:20:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF56E6B0007; Thu, 9 Jul 2020 07:20:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id D6A3B6B0005 for ; Thu, 9 Jul 2020 07:20:38 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 88285181AEF15 for ; Thu, 9 Jul 2020 11:20:38 +0000 (UTC) X-FDA: 77018294556.29.bulb53_28028f226ec5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 5B09F18086CD4 for ; Thu, 9 Jul 2020 11:20:38 +0000 (UTC) X-HE-Tag: bulb53_28028f226ec5 X-Filterd-Recvd-Size: 6386 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 11:20:37 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id v6so1904641iob.4 for ; Thu, 09 Jul 2020 04:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7q7kkmf8wZyu5ug5I9VjNgbwhsLCYY0Z9gPTp77FgyE=; b=m72c9lmdtddUuZSEuKmFaloK+d6prkvhzEMCNvxu12H/4EWQlyoqIhLZRGjXuKE5Cd 305maYmSdpNNpVPX/sGifLZu5sM4FSOjn+5pMa6Ji1T8374Sc52dynsNFRp44qZ1s1LD djl3PLvZV25CbO7t53Hlu45DRv8BdH6w7Y6S/qEL77Dlz2WvTz1Kn1k9uTqjYMXiankQ FcEDgAjPKPiSll/zp2XTGUBDhVPge9Pzm8A5XWXtOxR98S4g3jRitSjcNUOyPKoFEX4J ctTYXKi+NNF8nerjpz65aUo5MKf+T83aCg39LUdyW5CIlkKUdOI6+07406P24Vy5VyH3 aoDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7q7kkmf8wZyu5ug5I9VjNgbwhsLCYY0Z9gPTp77FgyE=; b=UGsI20IQkQBW4lakyKK8F2qvLtYetdHMhX4alB7rptID8cyVceudEhET6R73Gneodg N6X9TzQbebVp+0z+TQmDsSvrTEczalkO+4ijY9Obos/YZmWsdbvh6Z3u788qXG4cxFQT od4oxZFEeKg4qt23V94mbVNDFDe9bhp3IpJMAi80ZajLbKhwc3oBDGcn/JAglxgfol7w tgvPlnB1eCF6N9nC1cNoA7S0l4M6Oup2SVRAEGJ9kUOFzY+2kNqin2nGXxrmR3740TB7 jBBMMzITLOtSZeNGS6nAqPymQW3NwG32Hu9eXgyUGbWBKA4g5CFJDIHejGZb+2WaUDO7 /9yg== X-Gm-Message-State: AOAM531d/4pAYAJ8W0OOyB4qFlO2o1p06R4/nLqbcr3o/ZFsEm9ui52I 4kgDcfUmd9E49VMhXE/ZXMl3FAczdT0ai2cWMOI= X-Google-Smtp-Source: ABdhPJz0FlFUKvhOR52ze1uV0vP9JT6ZxlBDHqQ+9vehqjJWEXItQIQ5zTLj4B6Qj6+W2A7aIklPd+ZSVU/UWmQuqlg= X-Received: by 2002:a05:6602:2dd4:: with SMTP id l20mr41510009iow.13.1594293637259; Thu, 09 Jul 2020 04:20:37 -0700 (PDT) MIME-Version: 1.0 References: <20200709062603.18480-1-mhocko@kernel.org> <20200709062603.18480-2-mhocko@kernel.org> <20200709081813.GD19160@dhcp22.suse.cz> <20200709095840.GE19160@dhcp22.suse.cz> In-Reply-To: <20200709095840.GE19160@dhcp22.suse.cz> From: Yafang Shao Date: Thu, 9 Jul 2020 19:20:01 +0800 Message-ID: Subject: Re: [PATCH 2/2] doc, mm: clarify /proc//oom_score value range To: Michal Hocko Cc: Jonathan Corbet , Andrew Morton , David Rientjes , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 5B09F18086CD4 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, Jul 9, 2020 at 5:58 PM Michal Hocko wrote: > > 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. > -- All right. I don't insist if we think the change in range may break the userspace. -- Thanks Yafang