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=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 CC9B3C28CBC for ; Sat, 9 May 2020 06:53:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 73F022072F for ; Sat, 9 May 2020 06:53:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WoiJ4pfr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73F022072F 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 CC31D90001C; Sat, 9 May 2020 02:53:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7496900031; Sat, 9 May 2020 02:53:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBBFA90001C; Sat, 9 May 2020 02:53:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0035.hostedemail.com [216.40.44.35]) by kanga.kvack.org (Postfix) with ESMTP id A433290001C for ; Sat, 9 May 2020 02:53:51 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 64A742466 for ; Sat, 9 May 2020 06:53:51 +0000 (UTC) X-FDA: 76796265462.25.art75_21a2528443762 X-HE-Tag: art75_21a2528443762 X-Filterd-Recvd-Size: 5953 Received: from mail-il1-f195.google.com (mail-il1-f195.google.com [209.85.166.195]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Sat, 9 May 2020 06:53:51 +0000 (UTC) Received: by mail-il1-f195.google.com with SMTP id c18so3561232ile.5 for ; Fri, 08 May 2020 23:53:50 -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=uUEhOioMUS93dlkp4Cr67Jf/qlMjy8RLVtg/oke/DHw=; b=WoiJ4pfr48so+/dqNV5Kgme6+3JAEIXPwPtXbhOR4lmnqiH04A/mHkd02ADyZghkru aoN3Uv7GCNvNW0lkqONTHDYiQHpJg7XTvmqXLKPSs8/Lb0H48PJqDnnifkJY4fcoXn+9 KYChleT7MZ189GAJukrHgM83CNWyqVeuyzI6udJtj1G3RCVrLwkQ3/rxGian9mMKZWoI ReOZLBL4hbpH6QcGtEavFzabFyEAiLPSrlu0CmETn2Y+oTVYhaUADCDeZ9q9yyK0NvOP C2QoJ34TXNeSuEIrXZTjoFhKWolg665zSV6xqKRBYWKnVTA//RMK7SGNdkkJhAv6goGM NI2g== 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=uUEhOioMUS93dlkp4Cr67Jf/qlMjy8RLVtg/oke/DHw=; b=mPLEgGSm8573LgWNrvQJnQhNngTwXXwkj7lA3Y6MbZwvMkrtHOr0rxrhUVffb+RVFx ygNOgmawCib9J7DV5J634PB5DY5vZ6fNzEtHaZiaY3BoiA4TIsu7zpJ9zCNPVrcd5oiK 0ayHlv1TAumsS/GQqLjZ0mgDC4x9uUQ/ZGwrxYRLI8uKxlYoiCwXh3IXHaXPdIXk3l/F QLHWQX8xPrsE7ooC+YwHPigoiESx/3K4nDHftZ5ZCH8twYIU7tp0BRjNMCoZM85z3nrv +p55aXjQ/rc9cqiq6CW0opJLFvrGq9dPGvc+l4Iuy/m9hY8wbk8w3dmb8rtElCbIizZG KESQ== X-Gm-Message-State: AGi0PuYE2mz5kZt/iL7CIy96Ewwep5v2Q77Vc+btATE8lAXd6yIqFo7M FpLPhmaaAOL/3apAilH9dh44px5nZtnVisXCtBI= X-Google-Smtp-Source: APiQypJixX5XSny93qc69GJLQhJ9crL7NAzyIaoDQrhsQAeGPF+whF/G7rmuG24QwC0sTVPyAuhZqtsQNEObF94sU8Y= X-Received: by 2002:a92:1b91:: with SMTP id f17mr6741757ill.142.1589007230444; Fri, 08 May 2020 23:53:50 -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: Yafang Shao Date: Sat, 9 May 2020 14:53:14 +0800 Message-ID: Subject: Re: [PATCH] mm: vmscan: consistent update to pgsteal and pgscan To: Johannes Weiner Cc: Shakeel Butt , 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.000033, 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 9:38 PM 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. > Hi Johannes, When I used PSI to monitor memory pressure, I found there's the same behavoir in PSI that /proc/pressure/{memroy, IO} can be very large due to some limited cgroups rather the machine capacity. Should we separate /proc/pressure/XXX from /sys/fs/cgroup/XXX.pressure as well ? Then /proc/pressure/XXX only indicate the pressure due to machine capacity and /sys/fs/cgroup/XXX.presssure show the pressure throughout the cgroup tree. Besides that, there's another difference between /proc/pressure/XXX and /sys/fs/cgroup/XXX.pressure, which is when you disable the psi (i.e. psi=n) /proc/pressure/ will disapear but /sys/fs/cgroup/XXX.pressure still exist. If we separate them, this difference will be reasonable. > > 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. > > > > 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? > > 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 Yafang