Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7037282imu; Mon, 3 Dec 2018 06:50:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/XzSb/6yE2Xm/kVr2YDTccMHtQWmJcvvnRaBwvmSBIx1YWkyJStFhzbY1PDq5kngwCjd6Nk X-Received: by 2002:a63:be4d:: with SMTP id g13mr13564797pgo.378.1543848645182; Mon, 03 Dec 2018 06:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543848645; cv=none; d=google.com; s=arc-20160816; b=dW7C7sJd3AS6Zqh2CNbv6DiUCC8Vt3YL7ywnqxCSf/UEiptwz0gfzag1VV5xPnERFy lROJBsM0vUM/zg1M2QGjnZ/Xxkq/kVGWabCLunS6wNykpEdDDFeV3IBYb/oBqTeqkyvD iM1yQtMaKdunSxqWUznd5Y2lu0dQYIspjcBuZJGJ7pxmV9pt9vP20uBIU5N+lv4YvP/6 ncRtf/1F8SIj2m0qrHQbaeyAI0qB6uOvlGsP7oKQBvmnRaGl88DqzQsYmlwa/0fVoEuJ vQDDxpNEmkgPzHaTUXuVf0UH6l3jIBotHNYGViwc+oO48RP2/E84QvSsVEMtR8GwOwbb S37g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:reply-to; bh=U0cnIK/UpuvIAfZtFadxJQFmauLqMN7PTxOI2moClQQ=; b=k8Hba8izn1CaAXKWyHt+ksdcJT3fvd1Sd6a4LmgNekT8CWvbXZTXvt9+MwwpDfkq5j 2m90hDUsf+661DiA7y18QHgaAsZt0IKsGjv/yySlPBd9sQqRqEZoUiYruFNTKIC5rFf2 2vHwdVOVrEYoHbWace5KTWf+RPoX9/SMFrzIwO21R0Qg5SxW3e9Wq0lSD9yvFrTLZfwH YgjkW837bY2WizRTtHSpiQyZJunq9f356e3nFqu754CHeuf8RvwT71MyujvgHMcM8hPv ZHNXfEPk30Pa4gUoN8R2PCWL+SsJKyAmaHWk5+iQtxNZ/4dQC+okOqGHYBrCycsbQXmC QmLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k5si13255987pgr.69.2018.12.03.06.50.30; Mon, 03 Dec 2018 06:50:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbeLCOur (ORCPT + 99 others); Mon, 3 Dec 2018 09:50:47 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:43483 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726116AbeLCOur (ORCPT ); Mon, 3 Dec 2018 09:50:47 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R501e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01429;MF=xlpang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0TElAQiJ_1543848559; Received: from xunleideMacBook-Pro.local(mailfrom:xlpang@linux.alibaba.com fp:SMTPD_---0TElAQiJ_1543848559) by smtp.aliyun-inc.com(127.0.0.1); Mon, 03 Dec 2018 22:49:19 +0800 Reply-To: xlpang@linux.alibaba.com Subject: Re: [PATCH 1/3] mm/memcg: Fix min/low usage in propagate_protected_usage() To: Michal Hocko Cc: Roman Gushchin , Johannes Weiner , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20181203080119.18989-1-xlpang@linux.alibaba.com> <20181203115453.GO31738@dhcp22.suse.cz> From: Xunlei Pang Message-ID: <1c62ec71-52de-3597-ec87-3dd8d81c4d2a@linux.alibaba.com> Date: Mon, 3 Dec 2018 22:49:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181203115453.GO31738@dhcp22.suse.cz> Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/12/3 ????7:54, Michal Hocko wrote: > On Mon 03-12-18 16:01:17, Xunlei Pang wrote: >> When usage exceeds min, min usage should be min other than 0. >> Apply the same for low. > > Why? What is the actual problem. children_min_usage tracks the total children usages under min, it's natural that min should be added into children_min_usage when above min, I can't image why 0 is added, is there special history I missed? See mem_cgroup_protected(), when usage exceeds min, emin is calculated as "parent_emin*min/children_min_usage". > >> Signed-off-by: Xunlei Pang >> --- >> mm/page_counter.c | 12 ++---------- >> 1 file changed, 2 insertions(+), 10 deletions(-) >> >> diff --git a/mm/page_counter.c b/mm/page_counter.c >> index de31470655f6..75d53f15f040 100644 >> --- a/mm/page_counter.c >> +++ b/mm/page_counter.c >> @@ -23,11 +23,7 @@ static void propagate_protected_usage(struct page_counter *c, >> return; >> >> if (c->min || atomic_long_read(&c->min_usage)) { >> - if (usage <= c->min) >> - protected = usage; >> - else >> - protected = 0; >> - >> + protected = min(usage, c->min); >> old_protected = atomic_long_xchg(&c->min_usage, protected); >> delta = protected - old_protected; >> if (delta) >> @@ -35,11 +31,7 @@ static void propagate_protected_usage(struct page_counter *c, >> } >> >> if (c->low || atomic_long_read(&c->low_usage)) { >> - if (usage <= c->low) >> - protected = usage; >> - else >> - protected = 0; >> - >> + protected = min(usage, c->low); >> old_protected = atomic_long_xchg(&c->low_usage, protected); >> delta = protected - old_protected; >> if (delta) >> -- >> 2.13.5 (Apple Git-94) >> >