Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp198292ybk; Fri, 8 May 2020 23:55:53 -0700 (PDT) X-Google-Smtp-Source: APiQypKnCbBLcz6o/H0QgER5vqivFABfuwUm67uV3fPoSa+vHSMMNLJ/FjWKd4C18cO0VHHhqq8H X-Received: by 2002:aa7:ca4c:: with SMTP id j12mr5127716edt.360.1589007352830; Fri, 08 May 2020 23:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589007352; cv=none; d=google.com; s=arc-20160816; b=TQPCsRCrsC7o0+WYQr4J6Vr/J92ngth1dRD8Qy53KHqV3N+qGXt8OiztBD+4r7TZIc LUZjbt39l+tvStzNDPqL2zBkn2qiAAbzwhF8BYK1lT34mMxHXAoGOk6QtMob41EzYETL GokI7ka/PY+GSNdO9Do1IGrICXO/R1lzKGkwsdGLnkSLXf0DGp0IFYCtoQP2eKbtBEo3 F81ljzr7zocqJpcpDS6DwUr/jW3Pi+TRmSOL9R8hB0tIah07/appMEcxaaicOEXOyb4w DMcGoO1pjlTSE0cZ5dg6TK/ZjpDcLQg6jNnaY0/t9bWtTanAl3tjeXkFyK6TfHEOOVar qbog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uUEhOioMUS93dlkp4Cr67Jf/qlMjy8RLVtg/oke/DHw=; b=rwwBlsOXzSdXTcyI9dp5pghweHP/tIWqjEEu4nIli38PzN6ogSmgb+l/th1OJE0Apt Bmns6ivvqakoI1ctGi6WPWwyS4xZ3gWpcY6HvV3ePUBsJLxAPwDkSbZIt2OlTyhl/ee+ Ekm9p6gl7vW6vuj6B+Qgxb/NrPj/K92Ll9KixgQXHpNuHdzbVYh2RDnWcs1u/w0GgOWf sd9SG5ZoSOck1C/XejV9DNcHex17OCSYMBGbL+GfyE2wO4Ya11diG/aYAhnD1MSOckOX af9qs01u19oeLeNfqv4k8UtQVL0yRgIRLmm9G53qgBe6ohpTDLttTplNe5qHG7ZUWYSB Q07w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WoiJ4pfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q24si2232815edr.166.2020.05.08.23.55.29; Fri, 08 May 2020 23:55:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WoiJ4pfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728997AbgEIGxw (ORCPT + 99 others); Sat, 9 May 2020 02:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728471AbgEIGxv (ORCPT ); Sat, 9 May 2020 02:53:51 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B29C3C061A0C for ; Fri, 8 May 2020 23:53:52 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id x2so3543331ilp.13 for ; Fri, 08 May 2020 23:53:52 -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=HSlerH+lb35l/+xc5W9EGH3Xbwc6+m8f0eIoyrxaO4LVBETrcQPhOvkNyat0LARKIY YU1u4J71U2rpxeoX8VTeNunv98xTXiKaG8+/B3/rng9geLFJaIG+lf2iaLgUj+pNghY5 jpTniF8JeMVJEpJQnNYTpsiyYqoXF3/3viJbQytHYEd+wHkYsiF3QKqiEhG2y9m4I/+s gfqKkRiCZqp59PiuxvQsfYLimC21skv7MgaCfxfgMTUpQLTQhYPnd0N7QShFBeniiHNA tamvTCq56/o0xpNXlSjI8rNvKpOizyJf4B7TJvmx0k7QM4rkOSPFCCqv0ylHstbdMVwB N+MA== X-Gm-Message-State: AGi0PuZiHRtn+qC2mB0n0HGzLDSXbwiZoVNWT3RNHVIw1/oc51foWOjx D3z+CIdfNCkbseQSViMehQarSRAkjH7jteWDlWc= 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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