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.6 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 07D1EC28CBC for ; Mon, 4 May 2020 03:03:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BE5F5206E6 for ; Mon, 4 May 2020 03:03:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OJG1n1uz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE5F5206E6 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 58BFB8E0006; Sun, 3 May 2020 23:03:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53BCD8E0001; Sun, 3 May 2020 23:03:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42B178E0006; Sun, 3 May 2020 23:03:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0116.hostedemail.com [216.40.44.116]) by kanga.kvack.org (Postfix) with ESMTP id 2CA5E8E0001 for ; Sun, 3 May 2020 23:03:45 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E0E158249980 for ; Mon, 4 May 2020 03:03:44 +0000 (UTC) X-FDA: 76777541568.06.train13_3dcaef3ee3e4e X-HE-Tag: train13_3dcaef3ee3e4e X-Filterd-Recvd-Size: 5776 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 03:03:44 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id i19so10778138ioh.12 for ; Sun, 03 May 2020 20:03:44 -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=hJRAC7SOBaSP7M/Wdt5Wo3vwYdDZL2kUpN/FdsX2WZc=; b=OJG1n1uzh5TExPUq36JyeNzSb7jkeiMeLWHkwHFQaaUXjxrIw2r2jMSfUfj4uB1398 meS9uERk5LVftriP2r3JGKmtaEgJ32fOGGY5tUogw4tWQFSAKnjgBtroZo4TyRsOUANG IjtNTv+AVGO/kcFASC0bqmS/kUKJ7c2zuxixQid7K0ORUkJuoUmxbCqnvhn26Cz92hxm hdEOG+6ICkNo3oMYJ19GUyqf+fphIPPzl23K0gDe+7MpWSA/bx3zUhnz8A5hbu1n36Hm d7wfqDxSydgHvg4nsEYFjuFMR6IRG1gJ7bx4gcP8IPnN8vbvDUKhgJUHUeRlGZy67Ryi 8aXA== 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=hJRAC7SOBaSP7M/Wdt5Wo3vwYdDZL2kUpN/FdsX2WZc=; b=r2i6D+Uu3W0POQ8ErJxjRx6Q4watwpZGcanYbJKyTa6C/Amra338IKekT3YK8/hpFy N0FkVhMIVGb8nwXOPwi7agqG/PBwUBuek2+OdXolvpsN7GmgI8OwlSx6FZLgtRcU1N+/ sipnqE/2HlQYah321hJoQZ7S5xGIAcWDGOzmk3K6p9u7IeBLSjg0TV3kIaCugFQx0wof e3ol3nZPD0zND2iS7TX6bgo9d/haK5QOc99ag/9jP0ka+MoYELEkPu7bY4KCsuJnvaxF A7Hze0KjTSMU62QZu77LUIKAzYNNIDnGA6cmwSTzi7L5RxnXAC8iODRoZv62aR4Jffaj TGpg== X-Gm-Message-State: AGi0PuYkK9Xqgs/ZVhTq8qaTWeIUZzbbY7GSqOSzTKjKEc7zY++Fxq/5 PdSOg+jUKandGEh/1p0dcUeIQsKnCMY4WjZ1rqk= X-Google-Smtp-Source: APiQypKuM9MdaUMB58xkUbfqUkr5cmvQHv3MOWHl3iTWQOkL/YyjEOx5DqKrFgyjT6l/z6Wv4s21zECHpVZer20q+ws= X-Received: by 2002:a02:5184:: with SMTP id s126mr13089734jaa.81.1588561422447; Sun, 03 May 2020 20:03:42 -0700 (PDT) MIME-Version: 1.0 References: <20200502143452.7640-1-laoar.shao@gmail.com> <20200502143452.7640-3-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Mon, 4 May 2020 11:03:06 +0800 Message-ID: Subject: Re: [PATCH 2/2] mm, memcg: don't try to kill a process if memcg is not populated To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Greg Thelen , 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 Mon, May 4, 2020 at 7:00 AM Shakeel Butt wrote: > > On Sat, May 2, 2020 at 7:35 AM Yafang Shao wrote: > > > > Recently Shakeel reported a issue which also confused me serveral months > > earlier. Bellow is his report - > > > > Lowering memory.max can trigger an oom-kill if the reclaim does not > > succeed. However if oom-killer does not find a process for killing, it > > dumps a lot of warnings. > > > > Deleting a memcg does not reclaim memory from it and the memory can > > linger till there is a memory pressure. One normal way to proactively > > reclaim such memory is to set memory.max to 0 just before deleting the > > memcg. However if some of the memcg's memory is pinned by others, this > > operation can trigger an oom-kill without any process and thus can log a > > lot un-needed warnings. So, ignore all such warnings from memory.max. > > lot *of* un-needed > Thanks. > > > > [shakeelb@google.com: commit log above] > > > > A better way to avoid this issue is to avoid trying to kill a process if > > memcg is not populated. > > Note that OOM is different with OOM kill. > > different *from* > Thanks > > OOM is a status that the > > system or memcg is out of memory, while OOM kill is a result that a > > process inside this memcg is killed when this memcg is in OOM status. > > That is the same reason why there're both MEMCG_OOM event and > > MEMCG_OOM_KILL event. If we have already known that there's nothing to > > kill, i.e. the memcg is not populated, then we don't need to have a try. > > need to try > Thanks > I think adding the discussion of memory.high is also useful in the > commit message. Basically why setting memory.max to 0 is better than > setting memory.high to 0 before deletion. The reason is remote > charging. > Sure, will add it. > > > > Cc: Shakeel Butt > > Cc: Johannes Weiner > > Cc: Michal Hocko > > Cc: Roman Gushchin > > Cc: Greg Thelen > > Signed-off-by: Yafang Shao > > Reviewed-by: Shakeel Butt > > > --- > > mm/memcontrol.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index 985edce98491..29afe3df9d98 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -6102,6 +6102,10 @@ static ssize_t memory_max_write(struct kernfs_open_file *of, > > } > > > > memcg_memory_event(memcg, MEMCG_OOM); > > + > > + if (!cgroup_is_populated(memcg->css.cgroup)) > > + break; > > + > > if (!mem_cgroup_oom_kill(memcg, GFP_KERNEL, 0)) > > break; > > } > > -- > > 2.18.2 > > -- Thanks Yafang