From: Shakeel Butt <shakeelb@google.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Michal Hocko <mhocko@suse.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Muchun Song <muchun.song@linux.dev>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: memcg: provide accurate stats for userspace reads
Date: Fri, 11 Aug 2023 19:08:19 -0700 [thread overview]
Message-ID: <CALvZod55S3XeK-MquTq0mDuipq8j0vFymQeX_XnPb_HuPK+oGQ@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkbF1tNi8v0W4Mnqs0rzpRBshOFepxFTa1SiSvmBEBUEvw@mail.gmail.com>
Hi all,
(sorry for late response as I was away)
On Fri, Aug 11, 2023 at 1:40 PM Yosry Ahmed <yosryahmed@google.com> wrote:
>
[...]
> > > >
> > > > Last note, for /proc/vmstat we have /proc/sys/vm/stat_refresh to trigger
> > > > an explicit refresh. For those users who really need more accurate
> > > > numbers we might consider interface like that. Or allow to write to stat
> > > > file and do that in the write handler.
> > >
> > > This wouldn't be my first option, but if that's the only way to get
> > > accurate stats I'll take it.
> >
> > To be honest, this would be my preferable option because of 2 reasons.
> > a) we do not want to guarantee to much on the precision front because
> > that would just makes maintainability much more harder with different
> > people having a different opinion of how much precision is enough and b)
> > it makes the more rare (need precise) case the special case rather than
> > the default.
>
> How about we go with the proposed approach in this patch (or the mutex
> approach as it's much cleaner), and if someone complains about slow
> reads we revert the change and introduce the refresh API? We might
> just get away with making all reads accurate and avoid the hassle of
> updating some userspace readers to do write-then-read. We don't know
> for sure that something will regress.
>
> What do you think?
Actually I am with Michal on this one. As I see multiple regression
reports for reading the stats, I am inclined towards rate limiting the
sync stats flushing from user readable interfaces (through
mem_cgroup_flush_stats_ratelimited()) and providing a separate
interface as suggested by Michal to explicitly flush the stats for
users ok with the cost. Since we flush the stats every 2 seconds, most
of the users should be fine and the users who care about accuracy can
pay for it.
next prev parent reply other threads:[~2023-08-12 2:08 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 4:58 [PATCH] mm: memcg: provide accurate stats for userspace reads Yosry Ahmed
2023-08-09 8:51 ` Michal Hocko
2023-08-09 12:31 ` Yosry Ahmed
2023-08-09 12:58 ` Michal Hocko
2023-08-09 13:13 ` Yosry Ahmed
2023-08-09 13:31 ` Michal Hocko
2023-08-09 18:33 ` Yosry Ahmed
2023-08-11 12:21 ` Michal Hocko
2023-08-11 19:02 ` Yosry Ahmed
2023-08-11 19:25 ` Michal Hocko
2023-08-11 20:39 ` Yosry Ahmed
2023-08-12 2:08 ` Shakeel Butt [this message]
2023-08-12 2:11 ` Yosry Ahmed
2023-08-12 2:29 ` Shakeel Butt
2023-08-12 2:35 ` Yosry Ahmed
2023-08-12 2:48 ` Shakeel Butt
2023-08-12 8:35 ` Michal Hocko
2023-08-12 11:04 ` Yosry Ahmed
2023-08-15 0:14 ` Tejun Heo
2023-08-15 0:28 ` Yosry Ahmed
2023-08-15 0:35 ` Tejun Heo
2023-08-15 0:39 ` Yosry Ahmed
2023-08-15 0:47 ` Tejun Heo
2023-08-15 0:50 ` Yosry Ahmed
2023-08-16 0:23 ` Shakeel Butt
2023-08-16 0:29 ` Yosry Ahmed
2023-08-16 1:14 ` Shakeel Butt
2023-08-16 2:19 ` Yosry Ahmed
2023-08-16 17:11 ` Shakeel Butt
2023-08-16 19:08 ` Tejun Heo
2023-08-16 22:35 ` Yosry Ahmed
2023-08-18 21:40 ` Yosry Ahmed
2023-08-21 20:58 ` Yosry Ahmed
2023-08-15 15:44 ` Waiman Long
2023-08-09 13:17 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALvZod55S3XeK-MquTq0mDuipq8j0vFymQeX_XnPb_HuPK+oGQ@mail.gmail.com \
--to=shakeelb@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=yosryahmed@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).