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=-2.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 49F36C432C0 for ; Tue, 26 Nov 2019 14:45:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 13EA220656 for ; Tue, 26 Nov 2019 14:45:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13EA220656 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 87A066B031A; Tue, 26 Nov 2019 09:45:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8297B6B031B; Tue, 26 Nov 2019 09:45:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7187D6B031C; Tue, 26 Nov 2019 09:45:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 594F66B031A for ; Tue, 26 Nov 2019 09:45:15 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 21FD352BF for ; Tue, 26 Nov 2019 14:45:15 +0000 (UTC) X-FDA: 76198701390.06.berry50_4ae19a38d8039 X-HE-Tag: berry50_4ae19a38d8039 X-Filterd-Recvd-Size: 5491 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Nov 2019 14:45:14 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id b11so3481529wmj.4 for ; Tue, 26 Nov 2019 06:45:14 -0800 (PST) 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:user-agent; bh=K9vd1MkmBZirtP+CSPYvLsOmsoGOhZ9VuRZZxIgig0A=; b=OvHqCIdrf2QLM2LTYOFvoRB3rWd8ZogC28QW7CAdpYsbYxF3mZn0UpTpa3EJGCCnqd vNE4TOFivpddG/uUuB6jmFybsdUB972nWm3BuAfk0cTPkwTTDR0LY4P3WA31fE7b75AF GefGRwih4H+A9fLl/vRE0SMNEcjWMpOPgb5ONfvsszYF22eNucn/i59LxfG+dg1BOWh0 jAVAtZjVnSgKhcWXFlBH0o4cmprtFnRkgXmikwPocGuLYx5kAAPzZSYTQhPmJgF1Pd7e /LZKdCDZKUgtwCh6gVR46TPEWzwI1XgpKLY65S0jd6C/ITVVTgxh1uXnqtuzAm7CJ6oq tcNw== X-Gm-Message-State: APjAAAUlu237YSR1dRn7Jcd5QPOe1IlLl0aOXY4cnBz9hmRT+o3Sf6kb WucAKJIiU8Qov/KA8EJRO4Q= X-Google-Smtp-Source: APXvYqzEd9GJUCR6ioo4xZgupi/KyFazstKCi9m/NO7T4SDb0hkBrFr3Iu43ekppkBQ078xldNebzg== X-Received: by 2002:a1c:99cb:: with SMTP id b194mr4880358wme.100.1574779513271; Tue, 26 Nov 2019 06:45:13 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id k18sm15431007wrm.82.2019.11.26.06.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 06:45:11 -0800 (PST) Date: Tue, 26 Nov 2019 15:45:10 +0100 From: Michal Hocko To: Yafang Shao Cc: Johannes Weiner , Vladimir Davydov , Andrew Morton , Linux MM Subject: Re: [PATCH] mm, memcg: avoid oom if cgroup is not populated Message-ID: <20191126144510.GH20912@dhcp22.suse.cz> References: <1574773369-1634-1-git-send-email-laoar.shao@gmail.com> <20191126131604.GF20912@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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 Tue 26-11-19 22:25:27, Yafang Shao wrote: > On Tue, Nov 26, 2019 at 9:16 PM Michal Hocko wrote: > > > > On Tue 26-11-19 08:02:49, Yafang Shao wrote: > > > There's one case that the processes in a memcg are all exit (due to OOM > > > group or some other reasons), but the file page caches are still exist. > > > These file page caches may be protected by memory.min so can't be > > > reclaimed. If we can't success to restart the processes in this memcg or > > > don't want to make this memcg offline, then we want to drop the file page > > > caches. > > > The advantage of droping this file caches is it can avoid the reclaimer > > > (either kswapd or direct) scanning and reclaiming pages from all memcgs > > > exist in this system, because currently the reclaimer will fairly reclaim > > > pages from all memcgs if the system is under memory pressure. > > > The possible method to drop these file page caches is setting the > > > hard limit of this memcg to 0. Unfortunately this may invoke the OOM killer > > > and generates lots of misleading outputs, that should not happen. > > > > I disagree that the output is misleading. Quite contrary, it provides a > > useful lead on the unreclaimable memory. > > > > We can show the unreclaimable memory independently, rather than print > the full oom output. > OOM killer is used to kill process, why do we invoke it when there's > no process ? > What's the advantage of doing it ? Consistency. > > > One misleading output is "Out of memory and no killable processes...", > > > while really there is no tasks rather than no killable tasks. > > > > Again, this is nothing misleading. No task is a trivial subset of no > > killable task. I do not see why we should treat one differently than the > > other. > > > > No killable tasks means there's task and the OOM killer may be invoked. > While no tasks means the OOM killer is useless. I disagree. > > > Furthermore, > > > the OOM output is not expected by the admin if he or she only wants to drop > > > the cahes and knows there're no processes running in this memcg. > > > > But this is not what hard limit reduced to 0 really does. No matter > > whether there is some task or not. It simply reclaims _all_ the memory > > as explained in other email. > > > > Are there any way to reclaim page cache only ? > No. Correct. And in absence of a solid usecase then I do not see a reason to add this. We have a global knob to achieve this and it has turned out to be abused and just used incorrectly most of the time. > I know it will relcaim all the memory. > If you really think this expression is a prolem, but does it > improtant that we should distingush between caches (both page caches > and kmem) and _all_ memory, especially when there's no processes ? I do not think we should distinguish different memory types and treat them differently when applying hard limit. -- Michal Hocko SUSE Labs