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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 87626C432C0 for ; Mon, 25 Nov 2019 08:14:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4DB9D207FD for ; Mon, 25 Nov 2019 08:14:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DB9D207FD 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 C02BC6B05B0; Mon, 25 Nov 2019 03:14:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB35B6B05B1; Mon, 25 Nov 2019 03:14:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC94F6B05B2; Mon, 25 Nov 2019 03:14:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 951EB6B05B0 for ; Mon, 25 Nov 2019 03:14:50 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 455B94DC0 for ; Mon, 25 Nov 2019 08:14:50 +0000 (UTC) X-FDA: 76194088740.07.gun28_6462bbaf29720 X-HE-Tag: gun28_6462bbaf29720 X-Filterd-Recvd-Size: 4004 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Nov 2019 08:14:49 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id t26so14752474wmi.4 for ; Mon, 25 Nov 2019 00:14:49 -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=4F+cEbmEWn6msJE4bwMTniAu8oZcs1mfTrMj0PbgAcQ=; b=gRED+asP0U6sokE4cNOmwV9y3yuH6/5eeC16ed0hROUC8H2TbSevNF8bGQJV+G51uO erYvC2b7hsqCMt9awK1leuxKeAjrdUhuJR4838Em9djMukkQF4//HNA0dnVheRBNyYs0 KQy745wh+xs9LBd0LHr+i7T24RVnrLqkDCBrGMq/7ouAU1JSfO4NhQrGabufbef+QAsW Mbp4bHeMq/s5VCIfWeFX3gK1V0q4KcvRWUKFINpxZs5r//FyDWO8yG6+4H35afDVfyA8 YFouap5j/Shyxm8kDBHhOzHxYxF13mWQ1NFFvbc57klZEdVvsNauyTKtaAjsa7g8jjs9 JhFA== X-Gm-Message-State: APjAAAV83Uxw0GGfMJHO33hcEK+yVDu34BuGRMFX07QZC5wyGcK/60OY WNlxzYV+VbkHBO1KAvwtDIA= X-Google-Smtp-Source: APXvYqzxzGuQYSphEofTxVuv2U7aYM3xRGx+lM5wxAu6Lf8sBHVnfgm5jJGmooAjkm1GaJo+8eGwPg== X-Received: by 2002:a1c:b1d4:: with SMTP id a203mr25859949wmf.160.1574669688612; Mon, 25 Nov 2019 00:14:48 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id d7sm9720994wrx.11.2019.11.25.00.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Nov 2019 00:14:47 -0800 (PST) Date: Mon, 25 Nov 2019 09:14:46 +0100 From: Michal Hocko To: Yafang Shao Cc: hannes@cmpxchg.org, vdavydov.dev@gmail.com, akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, memcg: don't protect pages if memcg is not populated Message-ID: <20191125081446.GA31714@dhcp22.suse.cz> References: <1574488602-11773-1-git-send-email-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1574488602-11773-1-git-send-email-laoar.shao@gmail.com> 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 Sat 23-11-19 00:56:42, Yafang Shao wrote: > memory.{min, low} keeps protecting pages in a memcg even if there're no > process running in this memcg. That makes nonsense, because if there're > no processes running in this memcg there may be something wrong happens > and these protected pages are not useful now. Well, the min resp. low limits protect charges rather than tasks. And thre are cases when there is no direct relation between the charged memory and a specific task - e.g. long living kernel objects or page cache. So there is nothing really unusual to have charges in an absence of any tasks. I do not really see any reason why the protection shouldn't apply to them. Such a be behavior would be quite inconsistent btw. Just imagine a case when there is _a_ task but that one doesn't really have any charges in the memcg. Why should we respect reclaim protection in that case? Btw. offlined memcgs already have no min/low watermarks protect. Do you have any specific usecase that suffers from this behavior? > Signed-off-by: Yafang Shao > --- > mm/memcontrol.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 1c4c08b..c96c282 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -6376,6 +6376,9 @@ enum mem_cgroup_protection mem_cgroup_protected(struct mem_cgroup *root, > if (memcg == root) > return MEMCG_PROT_NONE; > > + if (!cgroup_is_populated(memcg->css.cgroup)) > + return MEMCG_PROT_NONE; > + > usage = page_counter_read(&memcg->memory); > if (!usage) > return MEMCG_PROT_NONE; > -- > 1.8.3.1 -- Michal Hocko SUSE Labs