From: Nhat Pham <nphamcs@gmail.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
tj@kernel.org, cgroups@vger.kernel.org, shakeel.butt@linux.dev,
hannes@cmpxchg.org, lizefan.x@bytedance.com, longman@redhat.com,
kernel-team@cloudflare.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, mfleming@cloudflare.com,
joshua.hahnjy@gmail.com
Subject: Re: [PATCH V10] cgroup/rstat: Avoid flushing if there is an ongoing root flush
Date: Thu, 12 Sep 2024 11:24:59 -0700 [thread overview]
Message-ID: <CAKEwX=PcK=kJG-yxaoTYvJGNwQ=eTGo1m=ZraqYy1SyLDs9Asw@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkbMph337XbBTbWfF8kp_fStP3-rN77vfR5tcn2+wYfJPQ@mail.gmail.com>
On Thu, Sep 12, 2024 at 10:28 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> >
> > I'm not, but Joshua from my team is working on it :)
>
> Great, thanks for letting me know!
FWIW, I think the zswap_shrinker_count() path is fairly trivial to
take care of :) We only need the stats itself, and you don't even
need any tree traversal tbh - technically it is most accurate to track
zswap memory usage of the memcg itself - one atomic counter per
zswap_lruvec_struct should suffice.
obj_cgroup_may_zswap() could be more troublesome - we need the entire
subtree data to make the decision, at each level :) How about this:
1. Add a per-memcg counter to track zswap memory usage.
2. At obj_cgroup_may_zswap() time, the logic is unchanged - we
traverse the tree from current memcg to root memcg, grabbing the
memcg's counter and check for usage.
3. At obj_cgroup_charge_zswap() time, we have to perform another
upward traversal again, to increment the counters. Would this be too
expensive?
We still need the whole obj_cgroup charging spiel, for memory usage
purposes, but this should allow us to remove the MEMCG_ZSWAP_B.
Similarly, another set of counters can be introduced to remove
MEMCG_ZSWAPPED...
Yosry, Joshua, how do you feel about this design? Step 3 is the part
where I'm least certain about, but it's the only way I can think of
that would avoid any flushing action. You have to pay the price of
stat updates at *some* point :)
next prev parent reply other threads:[~2024-09-12 18:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 19:41 Jesper Dangaard Brouer
2024-09-04 21:10 ` Yosry Ahmed
2024-09-05 14:08 ` Jesper Dangaard Brouer
2024-09-05 17:31 ` Yosry Ahmed
2024-09-10 14:16 ` Jesper Dangaard Brouer
2024-09-10 18:55 ` Yosry Ahmed
2024-09-12 15:41 ` Jesper Dangaard Brouer
2024-09-12 16:34 ` Yosry Ahmed
[not found] ` <CAKEwX=PTA0OxisvY12Wa95s5KqzvQTXe1rZ7nw29nP+wR2dxkA@mail.gmail.com>
[not found] ` <CAJD7tkbMph337XbBTbWfF8kp_fStP3-rN77vfR5tcn2+wYfJPQ@mail.gmail.com>
2024-09-12 18:24 ` Nhat Pham [this message]
2024-09-12 18:50 ` Yosry Ahmed
2024-09-05 20:20 ` kernel test robot
2024-09-10 5:23 ` kernel test robot
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='CAKEwX=PcK=kJG-yxaoTYvJGNwQ=eTGo1m=ZraqYy1SyLDs9Asw@mail.gmail.com' \
--to=nphamcs@gmail.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hawk@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=kernel-team@cloudflare.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lizefan.x@bytedance.com \
--cc=longman@redhat.com \
--cc=mfleming@cloudflare.com \
--cc=shakeel.butt@linux.dev \
--cc=tj@kernel.org \
--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