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=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 210FCC38A2A for ; Fri, 8 May 2020 14:06:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DBC0324955 for ; Fri, 8 May 2020 14:06:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ceRHV0SN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DBC0324955 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 63A248E0005; Fri, 8 May 2020 10:06:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EA938E0003; Fri, 8 May 2020 10:06:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D9E08E0005; Fri, 8 May 2020 10:06:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0023.hostedemail.com [216.40.44.23]) by kanga.kvack.org (Postfix) with ESMTP id 33A1B8E0003 for ; Fri, 8 May 2020 10:06:00 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D354B181AEF0B for ; Fri, 8 May 2020 14:05:59 +0000 (UTC) X-FDA: 76793725638.14.dolls14_6e844c153112b X-HE-Tag: dolls14_6e844c153112b X-Filterd-Recvd-Size: 5729 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 14:05:59 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id t11so1518373lfe.4 for ; Fri, 08 May 2020 07:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=haWmS+1+Op4dfd1PUhzKPboaEpLi6w7LL8kma7vTFIQ=; b=ceRHV0SNg4h4ryrKrtL+3goG0C5w1BGZ6KqlDlRV87kNxeqK3n/RrJb77F/LD7K2kA ajA4v6WXyozZqr4ooDAaotW6Gmp4FSRZRsz+KBrUVuwipH9+gQAH66kcLQltW6kzCgAX k56pf083vAds2fUez4gXK949rfm5yqXY7RJ9ZhCN852Nn1+lrsqAfTmNSxQxGKLJsu1p xPNV21RUEmi+zihVeAo/MEyl18ZwkrvqtQ4oXiJ8L4EuE5auYTVNqBH9v8xXv+OBWUV9 +qXN+nn3ZxbaTQqQxc4yYAZK/ULG64bAfRo4PAypAXFuoM8Cn8KuLEWp7sW/DjSu70kd egLw== 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=haWmS+1+Op4dfd1PUhzKPboaEpLi6w7LL8kma7vTFIQ=; b=Q1rdBAdRD7HkVhgIoKPkcjhlKJ5LB9dWh4xtgh1UW0cQicqafSwI6hCLK1+QD3tUgA 9k1ElkQT/FVq7ShDBOcvaD+1O/aMrP6dplt5XX7+Y5rKz9HtCUAdBYsnYsFrJIW48Scn HrkpMtXTbXBvlAx8AofrKQ23VY/mhdSavqUEcryyAw0i7pwJUuUmSJ09T5oSWptOd/aU QKY98JceXrC0sJpmeQ8hZef6ZK1Dl/7fnODlEu5h25fTkznQdp/NnejcEulpEA7Us6/m G1z1yPTk7CEjuOumvqdljgU1eakYvruPGZwvtKpj9KhlyFB69/zbqJILzkkMp3VwJrdI cQmw== X-Gm-Message-State: AOAM531Bqbs9H1sFiqX7DvIU+Gy06iW5EDJaDS04O+sYfirRSpEt9PKy G+XqCRgYynVie0tTh+onrXBYKfhyY1N9NxFLSWlLwA== X-Google-Smtp-Source: ABdhPJzWKnpzpuP5Fo7MSokFci1F2YxKHYybV0HCCXbto4nKblgCcA1HHeNX6K7OjYTbWvgiqleAt6aGcHWTXLAbNOI= X-Received: by 2002:a19:f512:: with SMTP id j18mr2007829lfb.33.1588946757557; Fri, 08 May 2020 07:05:57 -0700 (PDT) MIME-Version: 1.0 References: <20200507204913.18661-1-shakeelb@google.com> <20200508133833.GA181181@cmpxchg.org> In-Reply-To: <20200508133833.GA181181@cmpxchg.org> From: Shakeel Butt Date: Fri, 8 May 2020 07:05:46 -0700 Message-ID: Subject: Re: [PATCH] mm: vmscan: consistent update to pgsteal and pgscan To: Johannes Weiner Cc: Yafang Shao , Mel Gorman , Roman Gushchin , Michal Hocko , Andrew Morton , Linux MM , LKML 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 Fri, May 8, 2020 at 6:38 AM Johannes Weiner wrote: > > On Fri, May 08, 2020 at 06:25:14AM -0700, Shakeel Butt wrote: > > On Fri, May 8, 2020 at 3:34 AM Yafang Shao wrote: > > > > > > On Fri, May 8, 2020 at 4:49 AM Shakeel Butt wrote: > > > > > > > > One way to measure the efficiency of memory reclaim is to look at the > > > > ratio (pgscan+pfrefill)/pgsteal. However at the moment these stats are > > > > not updated consistently at the system level and the ratio of these are > > > > not very meaningful. The pgsteal and pgscan are updated for only global > > > > reclaim while pgrefill gets updated for global as well as cgroup > > > > reclaim. > > > > > > > > > > Hi Shakeel, > > > > > > We always use pgscan and pgsteal for monitoring the system level > > > memory pressure, for example, by using sysstat(sar) or some other > > > monitor tools. > > I'm in the same boat. It's useful to have activity that happens purely > due to machine capacity rather than localized activity that happens > due to the limits throughout the cgroup tree. > > > Don't you need pgrefill in addition to pgscan and pgsteal to get the > > full picture of the reclaim activity? > > I actually almost never look at pgrefill. > Nowadays we are looking at reclaim cost on high utilization machines/devices and noticed that rmap walk takes more than 60/70% of the CPU cost of the reclaim. Kernel does rmap walks in shrink_active_list and shrink_page_list and pgscan and pgrefill are good approximations of the number of rmap walks during a reclaim. > > > But with this change, these two counters include the memcg pressure as > > > well. It is not easy to know whether the pgscan and pgsteal are caused > > > by system level pressure or only some specific memcgs reaching their > > > memory limit. > > > > > > How about adding cgroup_reclaim() to pgrefill as well ? > > > > > > > I am looking for all the reclaim activity on the system. Adding > > !cgroup_reclaim to pgrefill will skip the cgroup reclaim activity. > > Maybe adding pgsteal_cgroup and pgscan_cgroup would be better. > > How would you feel about adding memory.stat at the root cgroup level? > Actually I would prefer adding memory.stat at the root cgroup level as you noted below that more use-cases would benefit from it. > There are subtle differences between /proc/vmstat and memory.stat, and > cgroup-aware code that wants to watch the full hierarchy currently has > to know about these intricacies and translate semantics back and forth. > > Generally having the fully recursive memory.stat at the root level > could help a broader range of usecases. Thanks for the feedback. I will send the patch with the additional motivation.