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=-3.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 85AE0C3A5A9 for ; Sat, 2 May 2020 14:49:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3829221835 for ; Sat, 2 May 2020 14:49:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="xs4GKMTf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3829221835 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BC1238E0005; Sat, 2 May 2020 10:49:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4B008E0001; Sat, 2 May 2020 10:49:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EB908E0005; Sat, 2 May 2020 10:49:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 8412D8E0001 for ; Sat, 2 May 2020 10:49:12 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3D06B582D for ; Sat, 2 May 2020 14:49:12 +0000 (UTC) X-FDA: 76772061744.05.cook06_8a883f91ea400 X-HE-Tag: cook06_8a883f91ea400 X-Filterd-Recvd-Size: 4729 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Sat, 2 May 2020 14:49:11 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id q2so6145732qvd.1 for ; Sat, 02 May 2020 07:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YxfoRDLyx8ir4iw+5PvVbFRSoUsyEHkkYJ50RJYiiDs=; b=xs4GKMTfUsZfH95rZtiMBN+r7RkdYUA2iaxLNVgkx4DVToGZv4OFtBZpND50UdXLeA +RKhMLQqoHSTqYRD7hn+h17oqjeW1MmWtSVKLHoqsDsrSTGb34Kr9v/GL1WbWm1G/32i WIdJ+VQEM4O6rldTgq1GJrE2oOA1mzx+ds1I2PA0mtg0fpsC63zorLQRCiNfAaOzsxJr mEpMW+ocFg44TANydErt1owisZz5GPLbcYJEBbotUfTTkNxnVD3eRrVo4BaOrUFzF1/x uGWwy9UpoUs+9qSHWK6DWIN35DUg2KHr2ZcJ9vh5nxAEzBdy9kEaFv9grj2qg1fdd6qq 2XSg== 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=YxfoRDLyx8ir4iw+5PvVbFRSoUsyEHkkYJ50RJYiiDs=; b=QCBKPis7D6jAblPBAF/ltzK/Qhy+CC/d9NQQGNAaYmdcgS0SwFttB4QuJEnNLpuYIe KsCbsvoZd4Rtv+pe9mQS7C8mUP+VJF/RXXzuVR2ygnuS97Lp6k+70XLg/rSFo526z8MP QOzU/dPAWNTNAbI8GsVkFJsoMDXQ51sL0ZfL+Ji/OZBw/Z78yFAcCBxq6fqO8KlpwWw8 4QnALyy6lIv2+eeRF8rusQao7J5JZkN+Z3MwnjvahA7DlcNMiCyvQ55TGMrZPNLToeMl zIHyK6ux2KlcuHMeNLBztE0ILcAQXGRJddJ+K4fn0XfJoS8jTMkmYVdg33qrPtmI9Bbi xXEQ== X-Gm-Message-State: AGi0Pub5TY/a9eHofyowFCC3hDpyBsWAkfWcNA6d+XUfKCm9SkoQuKt3 1r1S4ctdQxtIZzqRcCUWl/1mew== X-Google-Smtp-Source: APiQypKJ8jKfM1e8rBZZfkjSDbVFHgGgyuhhHam2TYJEuDHsNX+5mmmlJYLMJF9OJqinhL2sUh518g== X-Received: by 2002:ad4:54c3:: with SMTP id j3mr8844670qvx.241.1588430951311; Sat, 02 May 2020 07:49:11 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:1439]) by smtp.gmail.com with ESMTPSA id a194sm5157536qkb.21.2020.05.02.07.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 May 2020 07:49:10 -0700 (PDT) Date: Sat, 2 May 2020 10:48:58 -0400 From: Johannes Weiner To: Yafang Shao Cc: akpm@linux-foundation.org, mhocko@kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, memcg: add workingset_restore in memory.stat Message-ID: <20200502144858.GC51551@cmpxchg.org> 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, May 02, 2020 at 10:18:49AM -0400, 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 > > Signed-off-by: Yafang Shao Thanks, yes, I've missed that counter a few times while debugging something but never gotten around to actually adding it. Acked-by: Johannes Weiner