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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=no 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 6D928C432C0 for ; Wed, 20 Nov 2019 10:54:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3003522440 for ; Wed, 20 Nov 2019 10:54:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kNtyujQ2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3003522440 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 A82166B0269; Wed, 20 Nov 2019 05:54:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A32ED6B026A; Wed, 20 Nov 2019 05:54:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9484D6B026B; Wed, 20 Nov 2019 05:54:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 7CA876B0269 for ; Wed, 20 Nov 2019 05:54:27 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 303525000 for ; Wed, 20 Nov 2019 10:54:27 +0000 (UTC) X-FDA: 76176346974.01.boys39_26c9ba1b42507 X-HE-Tag: boys39_26c9ba1b42507 X-Filterd-Recvd-Size: 6253 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Nov 2019 10:54:26 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id d83so22972362ilk.7 for ; Wed, 20 Nov 2019 02:54:26 -0800 (PST) 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=HhWF6xo8jMG1rOqijxJxRuvkhkrNKMXtsPZ2jHAvlmM=; b=kNtyujQ21W4P0Rlo35TsEHtm+FyULiTMDaBwd4Yz+Gqy21Cy6FLs21eWrbyYVlo8mK orlsxcTrFgd5e3UMJ3umTlWTf14bJEEZi3xGRXbhpxjxKWw6tW63Fz6+tjRteoGeArf3 l0jHYoxoDjx/ti5fdxzIvFXmktKjQUaYLcUELjz3yP0ImF9BO08OaRaJuYkT34HVQWBw 4VJmWDhLUp+5FEKUyJ9OLKhBZSP7l7DKfB/BnTLElLEuSiIDrT8h9cJ0xPgdCnnFPSqh 0HqRF99f/ILGonQmsrDLD/thI/007prdLgcA8lie4AVHpByOUWOxlLP3t0WUhWV9p6uD YNtQ== 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=HhWF6xo8jMG1rOqijxJxRuvkhkrNKMXtsPZ2jHAvlmM=; b=jV/ZLI2fd98opwVrKBJNt2Qy9x6sO/gVutBAM9fvDcnaegHio4aqh1U4wWoG6bQlm8 4q8KCy+d8oDuzbGUc4OrATWHvkiDy4Lwue8WJEZfi69no1eVeyJdZ4HfyKXIPMiH7sfc QvupQF/lUqsVuDj97cgbFQEDfrkznfdZ6gnm9vU2DTUiZo9OQqYKUWhAKwKYvc6wQHVa RSb9YejtMRrogG1Ob9rKVHJuTAQiu94Ek2XqnUyGblxNpRUnIBBv62Cn7EYwzSDCyxr2 i6opS79kQw5CDsJYxM6YOTs/TFAbtgWoOtD2Cl3p3BHiCPn/FW2N4CIJS0UqRvGCBnPS Y90w== X-Gm-Message-State: APjAAAXqfcCDUYzN6ggdIuXonCrBfOwGZ5OrLsT5+8J/LBrgt/oyxnIg it7bWBqgOlMAR3g8rg4w9ExKgZbJoIu/RFD/gjA= X-Google-Smtp-Source: APXvYqxPFrvG6Y1XHDc5fb7BzM6O14Nv1kjBa6my8RYLu9dDE3Bt3lOT+D07gXyn+8Q2+GD4HaDh5Ao02ZmPJ6WOIaE= X-Received: by 2002:a92:40d6:: with SMTP id d83mr2972344ill.168.1574247260778; Wed, 20 Nov 2019 02:54:20 -0800 (PST) MIME-Version: 1.0 References: <1574239985-1916-1-git-send-email-laoar.shao@gmail.com> <20191120102157.GF23213@dhcp22.suse.cz> In-Reply-To: <20191120102157.GF23213@dhcp22.suse.cz> From: Yafang Shao Date: Wed, 20 Nov 2019 18:53:44 +0800 Message-ID: Subject: Re: [PATCH] mm, memcg: show memcg min setting in oom messages To: Michal Hocko Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , Linux MM Content-Type: text/plain; charset="UTF-8" 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 Wed, Nov 20, 2019 at 6:22 PM Michal Hocko wrote: > > On Wed 20-11-19 03:53:05, Yafang Shao wrote: > > A task running in a memcg may OOM because of the memory.min settings of his > > slibing and parent. If this happens, the current oom messages can't show > > why file page cache can't be reclaimed. > > min limit is not the only way to protect memory from being reclaim. The > memory might be pinned or unreclaimable for other reasons (e.g. swap > quota exceeded for memcg). Both swap or unreclaimabed (unevicteable) is printed in OOM messages. If something else can prevent the file cache being reclaimed, we'd better show them as well. > Besides that, there is the very same problem > with the global OOM killer, right? And I do not expect we want to print > all memcgs in the system (this might be hundreds). > I forgot the global oom... Why not just print the memcgs which are under memory.min protection or something like a total number of min protected memory ? > > So it is better to show the memcg > > min settings. > > Let's take an example. > > bar bar/memory.max = 1200M memory.min=800M > > / \ > > barA barB barA/memory.min = 800M memory.current=1G (file page cache) > > barB/memory.min = 0 (process in this memcg is allocating page) > > > > The process will do memcg reclaim if the bar/memory.max is reached. Once > > the barA/memory.min is reached it will stop reclaiming file page caches in > > barA, and if there is no reclaimable pages in bar and bar/barB it will > > enter memcg OOM then. > > After this pacch, bellow messages will be show then (only includeing the > > relevant messages here). The lines begin with '#' are newly added info (the > > '#' symbol is not in the original messages). > > memory: usage 1228800kB, limit 1228800kB, failcnt 18337 > > ... > > # Memory cgroup min setting: > > # /bar: min 819200KB emin 0KB > > # /bar/barA: min 819200KB emin 819200KB > > # /bar/barB: min 0KB emin 0KB > > ... > > Memory cgroup stats for /bar: > > anon 418328576 > > file 835756032 > > ... > > unevictable 0 > > ... > > oom-kill:constraint=CONSTRAINT_MEMCG..oom_memcg=/bar,task_memcg=/bar/barB > > > > With the new added information, we can find the memory.min in bar/barA is > > reached and the processes in bar/barB can't reclaim file page cache from > > bar/barA any more. While without this new added information we don't know > > why the file page cache in bar can't be reclaimed. > > Well, I am not sure this is really usefull enough TBH. It doesn't give > you the whole picture and it potentially generates a lot of output in > the oom report. FYI we used to have a more precise break down of > counters in memcg hierarchy, see 58cf188ed649 ("memcg, oom: provide more > precise dump info while memcg oom happening") which later got rewritten > by c8713d0b2312 ("mm: memcontrol: dump memory.stat during cgroup OOM") > At least we'd better print a total protected memory in the oom messages. > Could you be more specific why do you really need this piece of > information? I have said in the commit log, that we don't know why the file cache can't be reclaimed (when evictable is 0 and dirty is 0 as well.) > > > Signed-off-by: Yafang Shao > > --- > > mm/memcontrol.c | 15 +++++++++++++-- > > 1 file changed, 13 insertions(+), 2 deletions(-) > -- > Michal Hocko > SUSE Labs