From: Yosry Ahmed <yosryahmed@google.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>, Yu Zhao <yuzhao@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Meta kernel team <kernel-team@meta.com>,
cgroups@vger.kernel.org
Subject: Re: [PATCH v2] memcg: use ratelimited stats flush in the reclaim
Date: Wed, 14 Aug 2024 17:22:33 -0700 [thread overview]
Message-ID: <CAJD7tkZW8OYrEHkuONFt4wGiYSAsyVsA30zroOxc=opi5r5iBQ@mail.gmail.com> (raw)
In-Reply-To: <CAKEwX=M7sWx94nJ0zK-46Xn8ZZHhcHQtb37qR0Jxit+8sAaQWg@mail.gmail.com>
On Wed, Aug 14, 2024 at 5:19 PM Nhat Pham <nphamcs@gmail.com> wrote:
>
> On Wed, Aug 14, 2024 at 4:49 PM Yosry Ahmed <yosryahmed@google.com> wrote:
> >
> >
> > We can also use such atomic counters in obj_cgroup_may_zswap() and
> > eliminate the rstat flush there as well. Same for zswap_current_read()
> > probably.
>
> zswap/zswapped are subtree-cumulative counters. Would that be a problem?
For obj_cgroup_may_zswap() we iterate the parents anyway, so I think
it should be fine. We will also iterate the nodes on each level, but
this is usually a small number and is probably cheaper than an rstat
flush (but I can easily be wrong).
For zswap_current_read() we need to iterate the children, not the
parents. At this point the rstat flush is probably much better, so we
can leave this one alone. It's a userspace read anyway, so it
shouldn't be causing problems.
>
> >
> > Most in-kernel flushers really only need a few stats, so I am
> > wondering if it's better to incrementally move these ones outside of
> > the rstat framework and completely eliminate in-kernel flushers. For
> > instance, MGLRU does not require the flush that reclaim does as
> > Shakeel pointed out.
> >
> > This will solve so many scalability problems that all of us have
> > observed at some point or another and tried to optimize. I believe
> > using rstat for userspace reads was the original intention anyway.
>
> But yeah, the fewer in-kernel flushers we have, the fewer
> scalability/lock contention issues there will be. Not an expert in
> this area, but sounds like a worthwhile direction to pursue.
next prev parent reply other threads:[~2024-08-15 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 21:53 Shakeel Butt
2024-08-13 21:58 ` Yosry Ahmed
2024-08-13 22:30 ` Shakeel Butt
2024-08-14 12:57 ` Jesper Dangaard Brouer
2024-08-14 16:32 ` Shakeel Butt
2024-08-14 23:03 ` Nhat Pham
2024-08-14 23:42 ` Shakeel Butt
2024-08-14 23:48 ` Yosry Ahmed
2024-08-15 0:19 ` Nhat Pham
2024-08-15 0:22 ` Yosry Ahmed [this message]
2024-08-15 0:29 ` Shakeel Butt
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='CAJD7tkZW8OYrEHkuONFt4wGiYSAsyVsA30zroOxc=opi5r5iBQ@mail.gmail.com' \
--to=yosryahmed@google.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hawk@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=nphamcs@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=yuzhao@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