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,INCLUDES_PATCH,MAILING_LIST_MULTI,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 DF5D4C3A5A9 for ; Mon, 4 May 2020 07:27:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9829D20746 for ; Mon, 4 May 2020 07:27:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="csXHDouW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9829D20746 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 400258E0006; Mon, 4 May 2020 03:27:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B1328E0001; Mon, 4 May 2020 03:27:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C6838E0006; Mon, 4 May 2020 03:27:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 126C58E0001 for ; Mon, 4 May 2020 03:27:29 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C3B2F180ACF61 for ; Mon, 4 May 2020 07:27:28 +0000 (UTC) X-FDA: 76778206176.23.stage78_242be524aa211 X-HE-Tag: stage78_242be524aa211 X-Filterd-Recvd-Size: 5309 Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 07:27:28 +0000 (UTC) Received: by mail-io1-f66.google.com with SMTP id b12so11221745ion.8 for ; Mon, 04 May 2020 00:27:28 -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=eMJTVwSpQyn/xhp6u+6GN4IMzd//JO41IoEamQ3Zdks=; b=csXHDouWQKCAwTYKTsY1cASrw5qLOU/SQ44aHH4e81YyhyyL+8s1fWSxJpJ5ffI8KV d+KwWvWpX5ERgqxViOJh805MGZR8BCZnslt3tne6AIXodMd4WEsBUwG/M0VOBAwFNoq/ oU3xk4oQzjzT+CaztpFeZHTqXMnSHlilEoXJMCxGQyN7vyPZXKZWhmzlAVnb3WwAJnb5 NLeog00FIK2RkmW7v4PBWkntAt2GFu5annHvVtE74Z0EiDD/M+632aOqt9WkfcJ4gf9m N0OKc0cld4iN3Iu3cQzZ979BtN1/FrwwapSxzY+BmT1CEdehAZkHwqcOs6OzMas34b+0 CZDQ== 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=eMJTVwSpQyn/xhp6u+6GN4IMzd//JO41IoEamQ3Zdks=; b=Mk6e/E6dzGml5w/tC3H9DpXyVmfyxOJ+ueZE2/4cNSgBVqrV1LPdVKka0O7F3QieXB 5XNRBeAWuxVuxUs/n+lseSp9gSFSzEkkc/ith1D5yfPgW05vZpxjilLSF/ZuRFf2K82e GWQCAAp/qLGs5KZnp5ndMmOnQZNUw+VfC95l73KHQu+eGW8Clg/oQ30/yi6MCB7UxhSl jzxo74mNoe8dRhJqGiBm/GIDAH5/bUr2y2dTh3cBAhpWN+3J9fZL9IDe0QMAF4rquvt3 v+gPHjaEt3QciAC+34btQJXwdkrawtH4Z61OCp/rC4DK6qSofyidBmUzPKusbZkaL6HO XSuA== X-Gm-Message-State: AGi0PuZnlW3xlN5XyqKzao9US72U8jymzYs1z2Xq01hLyLOU9vpG53Sz PuefD687mWskvkqAe9SuSdyVyBSWxw0dQA+SMxw= X-Google-Smtp-Source: APiQypKauny7pNm2r6ST+LyFVdIuSErhtJktThj5aZhJs1/fSoYNc1LcW+dhgsaA1u1qJZSgyljGoJvTH49r+fAsBPA= X-Received: by 2002:a6b:d219:: with SMTP id q25mr14278247iob.202.1588577247883; Mon, 04 May 2020 00:27:27 -0700 (PDT) MIME-Version: 1.0 References: <20200430182712.237526-1-shakeelb@google.com> <20200504070301.GC22838@dhcp22.suse.cz> In-Reply-To: <20200504070301.GC22838@dhcp22.suse.cz> From: Yafang Shao Date: Mon, 4 May 2020 15:26:52 +0800 Message-ID: Subject: Re: [PATCH] memcg: oom: ignore oom warnings from memory.max To: Michal Hocko Cc: Shakeel Butt , Johannes Weiner , Roman Gushchin , Greg Thelen , Andrew Morton , Linux MM , Cgroups , LKML 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 3:03 PM Michal Hocko wrote: > > On Fri 01-05-20 09:39:24, Yafang Shao wrote: > > On Fri, May 1, 2020 at 2:27 AM Shakeel Butt wrote: > > > > > > 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. > > > > > > > I have been confused by this behavior for several months and I think > > it will confuse more memcg users. > > Could you be more specific what has caused the confusion? > No task is different from no eligible task. No eligible task means there are some candidates but no one is eligible. Whille no task means there is no candidate. > > We should keep the memcg oom behavior consistent with system oom - no > > oom kill if no process. > > This is not the global mmemcg behavior. We do complain loud on no > eligible tasks and actually panic the system. Memcg cannot simply > do the same by default for obvious reasons. > As explianed above, no eligible task is different from no task. If there are some candidates but no one is eligible, the system will panic. While if there's no task, it is definitely no OOM, because that's an improssible thing for the system. > > What about bellow change ? > > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index e28098e13f1c..25fbc37a747f 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -6086,6 +6086,9 @@ static ssize_t memory_max_write(struct > > kernfs_open_file *of, > > continue; > > } > > > > + if (!cgroup_is_populated(memcg->css.cgroup)) > > + break; > > + > > memcg_memory_event(memcg, MEMCG_OOM); > > if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0)) > > break; > > I am not a great fan to be honest. The warning might be useful for other > usecases when it is not clear that the memcg is empty. > The other usecase can still get the oom status fomr the MEMCG_OOM event, see bellow, memcg_memory_event(memcg, MEMCG_OOM); + if (!cgroup_is_populated(memcg->css.cgroup)) + break; See also https://lore.kernel.org/linux-mm/20200504042621.10334-3-laoar.shao@gmail.com/T/#u -- Thanks Yafang