Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp220575ybj; Fri, 8 May 2020 10:09:12 -0700 (PDT) X-Google-Smtp-Source: APiQypKV32qEWh8gq67ZFqsGu2hnPL87SBNUZ8r4fH3e8KFJOkq4uYRSNXipluREb89bYoasKRkH X-Received: by 2002:a17:906:95cb:: with SMTP id n11mr722658ejy.182.1588957752130; Fri, 08 May 2020 10:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588957752; cv=none; d=google.com; s=arc-20160816; b=Dk5H7hUUeqSooiIrqFdOusElIxrOyu0x69xJ1+4s9RbrbFriyLXlCLGdsyVki3DJ41 W7TmMygoxRYAfRdzJNtPGKV4TT2kvY60gwmGxyKmFln5UNpJIgS9BpuzKkxtTP8l05lF D98p7vNoaV3W0+wA5M0dflF4gQuOfMQ0nzD3akGQEq7aC2QAOM1auqBEp7OxfcH74uWq Zh57+U4d1o9EFBS9hbuIIuDd7hTVySl5O9GteGVu+YqsW+zdh6UyWEYgL04DvLmNB6up gjVcLhmw0HBFFUituGCCqkfBN4K7fSM378xCGZF18crNVTiZssoD2oQrtSyOO54mNxR6 ebhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=BNj9Z6arsMIsAVorXWKDmEgiJTCFic/kTsm/LbalWf8=; b=tk3t1WMl3qMv8BRH4tr4yFMNXaxfIALDkCTsEeJxITxvWXVX+XSjstWee1YZxQqek5 I0eviq8rZooSqAS+7ptUOV0YopMp+Zu2Zo/Uikp5MyFWLzSYt8fv2qK6ELkrsgITUWZN JhijKEdzuRYqm083YMPrf2apmwhNFqSOSfxpmIx4KTURcO+DyMhWBcq4Iy0dRo3D4VIi pvS0EnJzk0GeVDIUh+IFGoM0GEscSk6lPHpwcLya9HuD+0zI+DXlXw6yIJl92cfD4EDh tabypP0ShXKqwthJExVS+IgmztBra7J5aNZ9q6L7CDHq7X1/eD/aL9QWbo5ykp1Hgq9c MfYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cWd8iE2B; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p11si1186565ejj.491.2020.05.08.10.08.47; Fri, 08 May 2020 10:09:12 -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=@google.com header.s=20161025 header.b=cWd8iE2B; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726904AbgEHRHB (ORCPT + 99 others); Fri, 8 May 2020 13:07:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726750AbgEHRHA (ORCPT ); Fri, 8 May 2020 13:07:00 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB2D2C061A0C for ; Fri, 8 May 2020 10:07:00 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id g11so2046867plo.20 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=Wjg7M9F3KT9USR5LkZ6YjarCFIZ4S/FmZLoh7a3q+5tQ1reuksyoWEirOL3o9g+6Dw 8chlYInvK+kRLGD3IXhsoRRA7uT65etIiOzCNEASf1qun41nwS4/Zw2z68KC0sNh9ynI nZKKQ3KETtdA4YG8KDcszMUMGLKbLnps+ZiOnn8jKyJMl4C82PTRZLPUkklbLqDr4jvo McPZsaZy1WLpuHDKlJmQt1kkGMIvnw8hF1tF6WqFz4zoKd+ieH3O9NavmDkBKVnJ6Pyb K0nF4HEx7BwmRKMWXjyhoNfwh5/A+PRGsI5TcYNbSlahPC2QR+vUiNGyLaCYl6+XhoGT 65Yw== X-Gm-Message-State: AGi0PuYxZ217vboWjcvDJdIu4wkNroiasXH4XfesQ/Dt6ne0466rqQGJ c6sQfYZYSZjTe2SkIYzJC1eULRt/PmJvjQ== 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 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 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 --- 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, }, { -- 2.26.2.645.ge9eca65c58-goog