Messages in this thread | | | From | Yosry Ahmed <> | Date | Tue, 3 Oct 2023 08:53:25 -0700 | Subject | Re: [PATCH v2 2/2] mm: memcg: normalize the value passed into memcg_rstat_updated() |
| |
On Tue, Oct 3, 2023 at 6:13 AM Johannes Weiner <hannes@cmpxchg.org> wrote: > > On Fri, Sep 22, 2023 at 05:57:40PM +0000, Yosry Ahmed wrote: > > memcg_rstat_updated() uses the value of the state update to keep track > > of the magnitude of pending updates, so that we only do a stats flush > > when it's worth the work. Most values passed into memcg_rstat_updated() > > are in pages, however, a few of them are actually in bytes or KBs. > > > > To put this into perspective, a 512 byte slab allocation today would > > look the same as allocating 512 pages. This may result in premature > > flushes, which means unnecessary work and latency. > > Yikes. > > I'm somewhat less concerned about the performance as I am about the > variance in flushing cost that could be quite difficult to pinpoint. > IMO this is a correctness fix and a code cleanup, not a performance > thing.
Agreed, the code right now has a subtle mistake.
> > > Normalize all the state values passed into memcg_rstat_updated() to > > pages. Round up non-zero sub-page to 1 page, because > > memcg_rstat_updated() ignores 0 page updates. > > > > Fixes: 5b3be698a872 ("memcg: better bounds on the memcg stats updates") > > Signed-off-by: Yosry Ahmed <yosryahmed@google.com> > > Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Thanks for taking a look!
| |