From patchwork Fri May 8 17:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 11537223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7698614C0 for ; Fri, 8 May 2020 17:07:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 429B82192A for ; Fri, 8 May 2020 17:07:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cWd8iE2B" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 429B82192A 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 3B7EF8E0005; Fri, 8 May 2020 13:07:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 341D28E0003; Fri, 8 May 2020 13:07:02 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2093B8E0005; Fri, 8 May 2020 13:07:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 046318E0003 for ; Fri, 8 May 2020 13:07:01 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A5B5F4995EC for ; Fri, 8 May 2020 17:07:01 +0000 (UTC) X-FDA: 76794181842.21.grape39_5a66c672d2904 X-Spam-Summary: 2,0,0,a2cd3065ff973d59,d41d8cd98f00b204,3s5g1xggkckgapismmtjowwotm.kwutqvcf-uusdiks.wzo@flex--shakeelb.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1437:1500:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2195:2198:2199:2200:2393:2559:2562:2895:2912:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3868:3871:3874:4321:5007:6261:6653:7903:9038:9969:10004:10400:10450:10455:11026:11473:11658:11914:12048:12297:12555:12895:13069:13161:13229:13311:13357:14181:14394:14659:14721:19904:19999:21080:21444:21451:21627:21939:30012:30029:30034:30054,0,RBL:209.85.214.201:@flex--shakeelb.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: grape39_5a66c672d2904 X-Filterd-Recvd-Size: 4219 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 17:07:01 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id e9so2064649pls.11 for ; Fri, 08 May 2020 10:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=BNj9Z6arsMIsAVorXWKDmEgiJTCFic/kTsm/LbalWf8=; b=cWd8iE2BULhsuzGBLhEY2ZykQklRkw+mBHU/UMcTu++CnkoD19Vwbyu9ZXAq+Hvjm3 eKnZGz1RV/GJTLIu+z8x3At8UyE3gi6rwQ2pKfNtHATsjtlhYJDACFP5XqkImrYM4REU o+Cqrm1AXu9jkv3QQPIjtPsZLxcHhocu8oRlAndWoiWFd4gsXxte2X28wRZ3L6ck0q1U fbOVueB3efN0mUTnXzEm1dz447Ij8sdDOPniira68MQcgRhGm0xO5FH37HOmdlVHeoTl 61LMlaKmNqqB299IJUdkAwrLrEj457QuNL3sBadYKkE8dCyJi8rIl7w0ts4Nwgy2jbxC Z4MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=BNj9Z6arsMIsAVorXWKDmEgiJTCFic/kTsm/LbalWf8=; b=LknG1rbly834yreUh8IESl8dXhNRKnkofS40eCuoJojnkqh9sgaGAvjQk43tMDg1Kr gGpu42udfrNzPhK4c1lDgOaa+uC6fKRTd+19zl1ntyjyVMqYI/goXPcorZ2ZsCo294LY rMt+3c8N+lWxZhjgFTHoMwJV/gKI3zLjjuiKPab1UFMjvyzQVdf08DDCwqcBc8yAiyTM P1IJgRmA/aZe8wtC4OVtDJYisDCOr7tx6Y54asuCJobpxbnLfeME6I/CXnPnxHoY+w4B blKGPwOdoYlHyx6V8zy7NpLmiFRi33i6h9XryXtGPxKy4yi/qrl9dB6LkFDXcmF3V9Tw v8OQ== X-Gm-Message-State: AGi0PubvYLHi8+8vrSFFYNM9v1XJRyGEY+cWodDScNtHlDnFf2R74n63 w0zXeCb3nqShT7u9/pe7EHpaJa6WRfafMQ== X-Google-Smtp-Source: APiQypKrBLgMtrlcvFvqs+YYSq+BuahkN4i99V9L7awg8oZ90Mopdcdc1Orq4jfGV/zJgBCe2sQ+Pg1xRpgTLQ== X-Received: by 2002:a17:90a:d312:: with SMTP id p18mr6749590pju.200.1588957619633; Fri, 08 May 2020 10:06:59 -0700 (PDT) Date: Fri, 8 May 2020 10:06:30 -0700 Message-Id: <20200508170630.94406-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.26.2.645.ge9eca65c58-goog Subject: [PATCH] memcg: expose root cgroup's memory.stat From: Shakeel Butt To: Mel Gorman , Johannes Weiner , Roman Gushchin , Michal Hocko Cc: Andrew Morton , Yafang Shao , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Shakeel Butt 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: 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. Please note that this difference is only for system level vmstats. The cgroup stats returned by memory.stat are actually consistent. The cgroup's pgsteal contains number of reclaimed pages for global as well as cgroup reclaim. So, one way to get the system level stats is to get these stats from root's memory.stat, so, expose memory.stat for the root cgroup. from Johannes Weiner: 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. Signed-off-by: Shakeel Butt Suggested-by: Johannes Weiner Acked-by: Johannes Weiner Acked-by: Yafang Shao Acked-by: Chris Down --- mm/memcontrol.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 05dcb72314b5..c300d52c07a5 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6230,7 +6230,6 @@ static struct cftype memory_files[] = { }, { .name = "stat", - .flags = CFTYPE_NOT_ON_ROOT, .seq_show = memory_stat_show, }, {