Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp451868ybk; Sat, 9 May 2020 07:47:18 -0700 (PDT) X-Google-Smtp-Source: APiQypKiJhbD0FL5yLS/4LTsMsV2ce2whnqncNE234fjFfjuut4GFSfeljiAVXIjiHYMq9lGKqp1 X-Received: by 2002:a17:906:bcec:: with SMTP id op12mr6542646ejb.245.1589035637820; Sat, 09 May 2020 07:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589035637; cv=none; d=google.com; s=arc-20160816; b=fto3b1WgIlXEDvRzLeq1v6qAPjTKrBqAz2IWhMgQNnovInQx87KdVO9XmB3xiZauwr 181y2z1oG3r3MlpIWi7ZxRmty0HGSfABe9nDKGooCbkozg1Y4yVKP8RMZBxKHFKNvS+7 xDemF+bloJwqL8nCvDJ7yS+AKNP/H/SPH+mpUKNEO7fA/IDrFDBlPhZvOF3kJQjOsf2o AllFzFQbsBql2+CqX/UtflSKG8rqPXNHWL/aXm9dl4rg09B5oYxv7+7BTQIeOepfOnmW 8U4HQdoZvQA6TH16fYYU2u0XCKAB0dTlLgpJ4WVslwcF/EfYObrBYTnrxiJg6st6Zrys 8R7w== 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=1hI9ycgQ4zeirYCayZqlQtbGCMAV/8BVRrWbFIPSt1Y=; b=sywuCyg7u7oPBUL3sNlUi3tCzcAvzPZi0bZKui5635Y0NQfBTvkruepcsjohvK04sr bttdVaff+6MrDqhX4MoSSsfoFKh3X1kwQLRMkX+gcbrQIV+LoVLrxtYmhOPvfyGaOHjI jK+LLgab2FVJkUTeAKp2Zw+AAakqWOcHzAHM2rY+FMJnivvt35P7ovFaFNrJfqr0Nsdu gEmx8ZUa9fH//goiLDKkQqb/FlKw4LuskLAoWcysEYC9S3Oyy8z4piobF5/4NqiNTbL2 agxLfhTbhgFZGtHSvaZFT/Mlm2zrfoq4GUcrJlqixf1sc3ux6DZwCXAPYyd2PzK5Y29A k5XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hQVS4ZPo; 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 lc17si2870016ejb.413.2020.05.09.07.46.54; Sat, 09 May 2020 07:47:17 -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=hQVS4ZPo; 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 S1728117AbgEIOob (ORCPT + 99 others); Sat, 9 May 2020 10:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726782AbgEIOob (ORCPT ); Sat, 9 May 2020 10:44:31 -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 F3489C061A0C; Sat, 9 May 2020 07:44:29 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id c18so4203470ile.5; Sat, 09 May 2020 07:44:29 -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=1hI9ycgQ4zeirYCayZqlQtbGCMAV/8BVRrWbFIPSt1Y=; b=hQVS4ZPoIo4VxX/5nd1aSmJN4WU/ZZmJHcLAK0FoUrWJBAcRAM/ZH0kP2mDH9c2Mcb SWM22Nu6jFYtWbCx6oRXIx6unbYZBjWZofzLjkBui4reST6xR05xkE87GIrR5C1m3dzn /92kWXQcQ9kk25WbZeFThY2H4xFK1gR/Z3VpDt8RMZSIKOLT9SWOYaFBQ2j34qWqxxIC pzM5kaLcIFLGXym3nG8SWO6bc5ZFMNw7EKTB96AW9LEYwK740cX1fJUNN7qoMIvsgLY4 5QMAeF0dqAoP2FmIxH0TTchL4SnXXtgR5qK5+41JQbkbw6btTdrYU7O4T8pNf1QtWZRR xqhA== 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=1hI9ycgQ4zeirYCayZqlQtbGCMAV/8BVRrWbFIPSt1Y=; b=l3WqGezqsxNBlaOipwBMrRoEui4e+kSJ+AcruQyIeFhLbc/2Wxe2v1FrY/i10gsZyI nPEr79sb8zUnSf6nuKvYXRB2B0XiB+spyuhnJfIh7BO1k7/oWgjo60KbJBt2e3xgN6ii eSi55rmOz4qJ0q1/IOTEqPI9tHOrdgdZHHpSbolUtMCvtSVa0DciZ0tSAykQRqbXFu+P w3mbVHA+xmqXUzRvFpj9hd+WSrjUfve0KBRCPcusgeF6uaDRYieJ6ICiPvZx1DgM/QJy 46ICpQftHcRYOYpJSWfMC0Zogq4FsvDGerfzVcB6PhoyGoHPNoyzmzs7crXQlb1V7HO/ l21g== X-Gm-Message-State: AGi0Pub/Z7Blr/skS4ZFWw6V5RDWKuttBTpj44FU2FNyKGb9Iakn8JRr QVvDKydimHH1pLKh1qzjl/Wt7t9Hfo6XPl02dU/UWUpx X-Received: by 2002:a92:5c57:: with SMTP id q84mr8328572ilb.203.1589035469351; Sat, 09 May 2020 07:44:29 -0700 (PDT) MIME-Version: 1.0 References: <20200508170630.94406-1-shakeelb@google.com> <20200508214405.GA226164@cmpxchg.org> In-Reply-To: From: Yafang Shao Date: Sat, 9 May 2020 22:43:53 +0800 Message-ID: Subject: Re: [PATCH] memcg: expose root cgroup's memory.stat To: Shakeel Butt Cc: Johannes Weiner , Mel Gorman , Roman Gushchin , Michal Hocko , Andrew Morton , Linux MM , Cgroups , 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 Sat, May 9, 2020 at 10:06 PM Shakeel Butt wrote: > > On Fri, May 8, 2020 at 2:44 PM Johannes Weiner wrote: > > > > On Fri, May 08, 2020 at 10:06:30AM -0700, 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. > > > > > > 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. > > > > The changelog begs the question why we don't just "fix" the > > system-level stats. It may be useful to include the conclusions from > > that discussion, and why there is value in keeping the stats this way. > > > > Right. Andrew, can you please add the following para to the changelog? > > Why not fix the stats by including both the global and cgroup reclaim > activity instead of exposing root cgroup's memory.stat? The reason is > the benefit of having metrics exposing the activity that happens > purely due to machine capacity rather than localized activity that > happens due to the limits throughout the cgroup tree. Additionally > there are userspace tools like sysstat(sar) which reads these stats to > inform about the system level reclaim activity. So, we should not > break such use-cases. > Acked-by: Yafang Shao > > > Signed-off-by: Shakeel Butt > > > Suggested-by: Johannes Weiner > > > > Acked-by: Johannes Weiner > > Thanks a lot. -- Thanks Yafang