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=-7.0 required=3.0 tests=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 04F02C4724C for ; Mon, 4 May 2020 09:10:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C76AD2054F for ; Mon, 4 May 2020 09:10:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C76AD2054F 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 5FF418E0005; Mon, 4 May 2020 05:10:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5AFA08E0003; Mon, 4 May 2020 05:10:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C5D48E0005; Mon, 4 May 2020 05:10:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 30B478E0003 for ; Mon, 4 May 2020 05:10:31 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DC5BE180AD83B for ; Mon, 4 May 2020 09:10:30 +0000 (UTC) X-FDA: 76778465820.04.list41_3ea676b5dfb0f X-HE-Tag: list41_3ea676b5dfb0f X-Filterd-Recvd-Size: 4729 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 09:10:30 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id k1so20004613wrx.4 for ; Mon, 04 May 2020 02:10:30 -0700 (PDT) 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; bh=G2v4N6vAh3GU4l4EmlMACJoumJEMLSgM0bAyGvfgSkM=; b=Q+/yvTDLuFRgb5T4qpjpppnknmAUDwTAXPzh9Qc/BxYG99Rq7B4vN7koVtnfCYd3tL Gqw7Y9sDN3UJMfwAQ8vYmiB8MQdxEhSR7O22ePZkRN5TQ8z2Oa5RhEFRWA74R1fw5y4n v2XO4knQgWbmmu51H6o1DmfN0A7kWPDxvNXofP5K3N+bCElxAIgRYIblxEAF0H4wpJeX oJp32VEYMxGHkB17oyPGMrYe0xJSGwppogzw9JIyQC/1zgxE7L8zR2PlhoKixPOLjgBS JyLmcElmC5gLMRZhfsB9Ysk4Pq+oktzjmD1O/cBeUhKrNUzXVuoi+/v4V+0kxZMdQXB9 Nl2Q== X-Gm-Message-State: AGi0PuYNtCZHwniuwQGQ4l/q9+D8TuVjMMpLetAVdFfssEzudJ6QkiCE CLjA7jPI/bxPPrGumANeIyc= X-Google-Smtp-Source: APiQypJyw3n0IHBmdiqgn9fnsLRJJWlsbi9fIGYAxzWFwArWufZ+UimDmkSyXBsMdjUg9JYDl0Asyg== X-Received: by 2002:a05:6000:108b:: with SMTP id y11mr16491317wrw.380.1588583429295; Mon, 04 May 2020 02:10:29 -0700 (PDT) Received: from localhost (ip-37-188-183-9.eurotel.cz. [37.188.183.9]) by smtp.gmail.com with ESMTPSA id n9sm17556005wrx.61.2020.05.04.02.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 02:10:28 -0700 (PDT) Date: Mon, 4 May 2020 11:10:27 +0200 From: Michal Hocko To: Yafang Shao Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, memcg: add workingset_restore in memory.stat Message-ID: <20200504091027.GK22838@dhcp22.suse.cz> References: <20200502141849.7465-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200502141849.7465-1-laoar.shao@gmail.com> 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 02-05-20 10:18:49, Yafang Shao wrote: > There's a new workingset counter introduced in commit 1899ad18c607 ("mm: > workingset: tell cache transitions from workingset thrashing"). With the > help of this counter we can know the workingset is transitioning or > thrashing. To leverage the benifit of this counter to memcg, we should > introduce it into memory.stat. Then we could know the workingset of the > workload inside a memcg better. > > Bellow is the verification of this new counter in memory.stat. > Read a file into the memory and then read it again to make these pages be > active. The size of this file is 1G. (memory.max is greater than file size) > The counters in memory.stat will be, > inactive_file 0 > active_file 1073639424 > > workingset_refault 0 > workingset_activate 0 > workingset_restore 0 > workingset_nodereclaim 0 > Trigger the memcg reclaim by setting a lower value to memory.high, and > then some pages will be demoted into inactive list, and then some pages > in the inactive list will be evicted into the storage. > inactive_file 498094080 > active_file 310063104 > > workingset_refault 0 > workingset_activate 0 > workingset_restore 0 > workingset_nodereclaim 0 > Then recover the memory.high and read the file into memory again. As a > result of it, the transitioning will occur. Bellow is the result of this > transitioning, > inactive_file 498094080 > active_file 575397888 > > workingset_refault 64746 > workingset_activate 64746 > workingset_restore 64746 > workingset_nodereclaim 0 Could you update Documentation/admin-guide/cgroup-v2.rst as well please? > Signed-off-by: Yafang Shao Acked-by: Michal Hocko > --- > mm/memcontrol.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 5beea03dd58a..0395e479995b 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -1451,6 +1451,8 @@ static char *memory_stat_format(struct mem_cgroup *memcg) > memcg_page_state(memcg, WORKINGSET_REFAULT)); > seq_buf_printf(&s, "workingset_activate %lu\n", > memcg_page_state(memcg, WORKINGSET_ACTIVATE)); > + seq_buf_printf(&s, "workingset_restore %lu\n", > + memcg_page_state(memcg, WORKINGSET_RESTORE)); > seq_buf_printf(&s, "workingset_nodereclaim %lu\n", > memcg_page_state(memcg, WORKINGSET_NODERECLAIM)); > > -- > 2.18.2 -- Michal Hocko SUSE Labs