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=-6.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,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 20326C3A5A9 for ; Mon, 4 May 2020 12:36:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CC27D206B9 for ; Mon, 4 May 2020 12:36:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IS4z1oKt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC27D206B9 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 7ACE58E0006; Mon, 4 May 2020 08:36:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 75D998E0003; Mon, 4 May 2020 08:36:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6737E8E0006; Mon, 4 May 2020 08:36:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0171.hostedemail.com [216.40.44.171]) by kanga.kvack.org (Postfix) with ESMTP id 5021D8E0003 for ; Mon, 4 May 2020 08:36:27 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 04C8B1AB59 for ; Mon, 4 May 2020 12:36:26 +0000 (UTC) X-FDA: 76778984814.26.tray72_72795a9c5561f X-HE-Tag: tray72_72795a9c5561f X-Filterd-Recvd-Size: 5589 Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 12:36:26 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id 19so12021634ioz.10 for ; Mon, 04 May 2020 05:36:26 -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=sbqQQNjkJB0syEycYzjg+ByiBE3mhuF4VIOUn4CTHjo=; b=IS4z1oKtnkZ5edsk2fzZUe/b7IlFnSeGs+PlhnzXzpWWinx8OaOgkN2kN1KUhg91vO Cjbo9t90c2Q+274pkpSrKHxZX960FshKv7TtOlqmiDCecWKZFLtuc4d1N7G+EZa/k5MG +d3AvdtGn70VAjaMshnVZHTK9ZQNqoO7G4z50c33/X45+uyQaKWyB10UQNTVc5ZcasPW 3MnSCIQzc5FwbdqXj+onoVnjmAAijX46otJzkv/iyVL78BUneC9Dy17+mIT2Dk/eizl9 wI3rGVLtWoeln0BfPpzNGFTabvOUI+Bnwb4Q8MpERthjjZlvmO0tR5fNvN1VeyZXQS3p A8AQ== 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=sbqQQNjkJB0syEycYzjg+ByiBE3mhuF4VIOUn4CTHjo=; b=RWkMS8XtMJP4wLRKCk6xmjf4XevG80NqJeSntImVRmJ5T1/yBNm1+oH0ptW8oS37Ag pHz+aAHkt33OsEEZLX5BarLjsuhMC1smXqt+mHjoz7tPKeqVUL207Qp27Jjtyc/HH0g+ pQlcD506ymyigpNQriAX2UTRcZgmFlMcugv/K/aPPdwD0An4pfFNQCmU6rbKb/qPO6nV aUKY9pTRx3kq0xYIzBzRS2sxGzXoO5lTBtOvrjfIKYJLKxMZ4MM/YUHld7+roq2g1vDA FTGp+ZDelPiVFUigyvylbEOXWXh8K3Fkypom1k9FGvfZ6H4hg8PSrZ3uYEJCcSyoMoyd ewmg== X-Gm-Message-State: AGi0Pub+E5DxSa0qn9g/wPTwpg/BFs3MqobR62cauACwTBE8Wk3KMKTR vakuy3TsTqvh7cuMH3Dw3glqS1AYDuuyML34L/w= X-Google-Smtp-Source: APiQypItfR3J26WO/kFrfuXO1cnzLuYZ3vLZivBKAhHKgDxAdJLY/QRTACye1EMvef4W3cv3Fy3bR6ut/KWUJJHEH48= X-Received: by 2002:a02:ccad:: with SMTP id t13mr15261195jap.64.1588595786026; Mon, 04 May 2020 05:36:26 -0700 (PDT) MIME-Version: 1.0 References: <20200502141849.7465-1-laoar.shao@gmail.com> <20200504091027.GK22838@dhcp22.suse.cz> In-Reply-To: <20200504091027.GK22838@dhcp22.suse.cz> From: Yafang Shao Date: Mon, 4 May 2020 20:35:50 +0800 Message-ID: Subject: Re: [PATCH] mm, memcg: add workingset_restore in memory.stat To: Michal Hocko Cc: Andrew Morton , Johannes Weiner , Linux MM 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 5:10 PM Michal Hocko wrote: > > 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? > Thanks for your reminder. I will update it. > > Signed-off-by: Yafang Shao > > Acked-by: Michal Hocko > Thanks. > > --- > > 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 -- Thanks Yafang