From: Ivan Babrou <ivan@cloudflare.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Waiman Long <longman@redhat.com>,
cgroups@vger.kernel.org, Linux MM <linux-mm@kvack.org>,
kernel-team <kernel-team@cloudflare.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Expensive memory.stat + cpu.stat reads
Date: Mon, 14 Aug 2023 10:56:23 -0700 [thread overview]
Message-ID: <CABWYdi2y+nsbum+0EnK4W_jF-8RNbNJJadiZH2Ofb_wnYjbrbA@mail.gmail.com> (raw)
In-Reply-To: <CALvZod65Y-dSkH6a=ASTDTK2oGznTd7Yts1csttxoP0w9jaQUw@mail.gmail.com>
On Fri, Aug 11, 2023 at 7:34 PM Shakeel Butt <shakeelb@google.com> wrote:
>
> Hi Ivan,
>
> (sorry for late response as I was away)
>
> On Fri, Aug 11, 2023 at 3:35 PM Ivan Babrou <ivan@cloudflare.com> wrote:
> [...]
> > > > I spent some time looking into this and I think I landed on a fix:
> > > >
> > > > * https://github.com/bobrik/linux/commit/50b627811d54
> > > >
> > > > I'm not 100% sure if it's the right fix for the issue, but it reduces
> > > > the runtime significantly.
>
> In your patch, can you try to replace mem_cgroup_flush_stats() with
> mem_cgroup_flush_stats_ratelimited() instead of cgroup_rstat_flush().
> I wanted to see if you observe any stale stats issues.
We scrape cgroup metrics every 53s and at that scale I doubt we'd
notice any staleness. With 2s FLUSH_TIME it would be in the noise. We
can even remove any sort of flushing from memory.stat as long as
cpu.stat is read right before it as it does flushing for both.
I agree with Yosry that there's probably no reason to flush both cpu
and memory stats at the same time.
It doesn't seem right to use delayed flush for memory and direct flush
for cpu. Perhaps it doesn't matter as much to warrant a bigger rework
of how it's done, but maybe then my patch to use the same mechanism
between cpu and memory flushing makes sense?
next prev parent reply other threads:[~2023-08-14 17:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 23:22 Ivan Babrou
2023-07-06 6:20 ` Shakeel Butt
2023-07-10 23:21 ` Ivan Babrou
2023-07-11 0:44 ` Waiman Long
2023-07-13 23:25 ` Ivan Babrou
2023-07-14 17:23 ` Waiman Long
2023-07-15 0:00 ` Ivan Babrou
2023-07-15 0:30 ` Ivan Babrou
2023-08-11 22:03 ` Ivan Babrou
2023-08-11 22:27 ` Waiman Long
2023-08-11 22:35 ` Ivan Babrou
2023-08-12 2:33 ` Shakeel Butt
2023-08-14 17:56 ` Ivan Babrou [this message]
2023-08-11 23:43 ` Yosry Ahmed
2023-08-12 0:01 ` Yosry Ahmed
2023-08-15 0:18 ` Tejun Heo
2023-08-15 0:30 ` Ivan Babrou
2023-08-15 0:31 ` Yosry Ahmed
2023-07-15 0:14 ` Ivan Babrou
2023-07-10 14:44 ` Michal Koutný
2023-07-10 23:23 ` Ivan Babrou
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=CABWYdi2y+nsbum+0EnK4W_jF-8RNbNJJadiZH2Ofb_wnYjbrbA@mail.gmail.com \
--to=ivan@cloudflare.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@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