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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 BD13CC47247 for ; Sat, 9 May 2020 14:44:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98D0021775 for ; Sat, 9 May 2020 14:44:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hQVS4ZPo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbgEIOob (ORCPT ); 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-Google-Smtp-Source: APiQypJeZbqR8cOxrIaCuTPsIeig2FGnuaB6IFS+w/IMBZaiGq2pK3JXRXRsR8/B4ve1cSseku7gziAyJDlCxouLxY4= 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 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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 80CD5C28CBC for ; Sat, 9 May 2020 14:44:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3BF9220735 for ; Sat, 9 May 2020 14:44:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hQVS4ZPo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BF9220735 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 C72D58E0006; Sat, 9 May 2020 10:44:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C23688E0003; Sat, 9 May 2020 10:44:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B682F8E0006; Sat, 9 May 2020 10:44:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id 9CEA68E0003 for ; Sat, 9 May 2020 10:44:30 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 515D8181AEF0B for ; Sat, 9 May 2020 14:44:30 +0000 (UTC) X-FDA: 76797451500.25.box31_4465e1a14594e X-HE-Tag: box31_4465e1a14594e X-Filterd-Recvd-Size: 5486 Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Sat, 9 May 2020 14:44:29 +0000 (UTC) Received: by mail-il1-f196.google.com with SMTP id s10so4172874iln.11 for ; 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=M1NHiL9R8lhvZIbXs1NEY03vBh9FF3C9acww2Vh8BydDxteiMgo14+qUaUfiFECnSK aDBAQM2FgzZ01PxJ27EzK7103vJTuR/axn8CB9bxZt4+7V3pwRDzYGt38Fqq61R8E2w0 MYufJqOLiRl05l+sOTjoQPXYle6agJG5EKhx8zoWC8WYw5i6zDM/FL3B5/AbIfi/VUYY flrthR4ilTC8zFvdh15DGS8x1MJOzDz8rrtnFmtK1GROXPxgVN9xML6Az3+LyxNAqLjq kC0pH/vQdMyGZsfHYzD3np8tYox8sSEJbZNJS9Z4KXGPLCymS02Q/4vv90t2TA2wnBVP 9a7A== X-Gm-Message-State: AGi0PuZ3kl4PBZ/E9IuutABLqhxOn3yHO/z7WpCiK5yuLomNw0rD44qH Bx1iI9//gAhVMbfz3cLGYL7gJ5yTe1WWTsPBqco= X-Google-Smtp-Source: APiQypJeZbqR8cOxrIaCuTPsIeig2FGnuaB6IFS+w/IMBZaiGq2pK3JXRXRsR8/B4ve1cSseku7gziAyJDlCxouLxY4= 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" 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: 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yafang Shao Subject: Re: [PATCH] memcg: expose root cgroup's memory.stat Date: Sat, 9 May 2020 22:43:53 +0800 Message-ID: References: <20200508170630.94406-1-shakeelb@google.com> <20200508214405.GA226164@cmpxchg.org> Mime-Version: 1.0 Return-path: 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== In-Reply-To: Sender: cgroups-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Shakeel Butt Cc: Johannes Weiner , Mel Gorman , Roman Gushchin , Michal Hocko , Andrew Morton , Linux MM , Cgroups , LKML 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