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=-11.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,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 E00EEC2D0A8 for ; Sun, 27 Sep 2020 02:39:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3AEA2239D0 for ; Sun, 27 Sep 2020 02:39:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AEA2239D0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2A1D26B005C; Sat, 26 Sep 2020 22:39:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 252226B005D; Sat, 26 Sep 2020 22:39:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18F086B0068; Sat, 26 Sep 2020 22:39:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 04BDE6B005C for ; Sat, 26 Sep 2020 22:39:39 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A52E91E07 for ; Sun, 27 Sep 2020 02:39:38 +0000 (UTC) X-FDA: 77307285636.06.tent56_45060bf27175 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 92D441018C2D2 for ; Sun, 27 Sep 2020 02:39:38 +0000 (UTC) X-HE-Tag: tent56_45060bf27175 X-Filterd-Recvd-Size: 3703 Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Sun, 27 Sep 2020 02:39:37 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=zhongjiang-ali@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UA9zudR_1601174362; Received: from L-X1DSLVDL-1420.local(mailfrom:zhongjiang-ali@linux.alibaba.com fp:SMTPD_---0UA9zudR_1601174362) by smtp.aliyun-inc.com(127.0.0.1); Sun, 27 Sep 2020 10:39:23 +0800 Subject: Re: [PATCH] mm: Do not deactivate when the cgroup has plenty inactive page To: Michal Hocko Cc: hannes@cmpxchg.org, akpm@linux-foundation.org, linux-mm@kvack.org References: <1601034552-95831-1-git-send-email-zhongjiang-ali@linux.alibaba.com> <20200925120758.GF3389@dhcp22.suse.cz> From: zhong jiang Message-ID: Date: Sun, 27 Sep 2020 10:39:22 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:81.0) Gecko/20100101 Thunderbird/81.0 MIME-Version: 1.0 In-Reply-To: <20200925120758.GF3389@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000753, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2020/9/25 8:07 =E4=B8=8B=E5=8D=88, Michal Hocko wrote: > On Fri 25-09-20 19:49:12, zhongjiang-ali wrote: >> After appling the series patches(mm: fix page aging across multiple cg= roups), >> cgroup memory reclaim strategy is based on reclaim root's inactive:act= ive >> ratio. if the target lruvec need to deactivate, its children cgroup al= so will >> deactivate. That will result in hot page to be reclaimed and other cgr= oup's >> cold page will be left, which is not expected. >> >> The patch will not force deactivate when inactive_is_low is not true u= nless >> we has scanned the inactive list and memory is unable to reclaim. > Do you have any data to present? I write an testcase that cgroup B has a lot of hot pagecache and cgroup=20 C=C2=A0 is full of cold pagecache.=C2=A0 and their parent cgroup A will trigger the reclaim due of it's limit has=20 been breached. The testcase should assume that we should not reclaim the=C2=A0 hot pagec= ache=20 in cgroup B because C has plenty cold pagecache.=C2=A0=C2=A0 Unfortunately,=C2=A0 I can see cgroup = B hot=20 pagecache has been decreased when cgroup A trigger the reclaim. Thanks, > >> Signed-off-by: zhongjiang-ali >> --- >> mm/vmscan.c | 15 ++++++++++++++- >> 1 file changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index 466fc31..77d395f 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -2407,8 +2407,21 @@ static void get_scan_count(struct lruvec *lruve= c, struct scan_control *sc, >> case SCAN_FILE: >> case SCAN_ANON: >> /* Scan one type exclusively */ >> - if ((scan_balance =3D=3D SCAN_FILE) !=3D file) >> + if ((scan_balance =3D=3D SCAN_FILE) !=3D file) { >> scan =3D 0; >> + } else { >> + /* >> + * Reclaim memory is based on the root's inactive: active >> + * ratio, but it is possible that silbing cgroup has a lot >> + * of cold memory to reclaim rather than reclaim the hot >> + * cache in the current cgroup. >> + */ >> + if (!sc->force_deactivate && is_active_lru(lru) && >> + !inactive_is_low(lruvec, lru - LRU_ACTIVE)) { >> + if (sc->may_deactivate & (1 << file)) >> + scan =3D 0; >> + } >> + } >> break; >> default: >> /* Look ma, no brain */ >> --=20 >> 1.8.3.1 >>