From: Johannes Weiner <hannes@cmpxchg.org>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: linux-kernel@vger.kernel.org, Michal Hocko <mhocko@kernel.org>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
Muchun Song <muchun.song@linux.dev>,
Shakeel Butt <shakeelb@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] mm: memcg: use rstat for non-hierarchical stats
Date: Wed, 26 Jul 2023 11:13:15 -0400 [thread overview]
Message-ID: <20230726151315.GB1365610@cmpxchg.org> (raw)
In-Reply-To: <CAJD7tkZK2T2ebOPw6K0M+YWyKUtx9bE2uyFj4VOehhd+fYnk8w@mail.gmail.com>
On Tue, Jul 25, 2023 at 05:36:45PM -0700, Yosry Ahmed wrote:
> On Tue, Jul 25, 2023 at 5:29 PM Yosry Ahmed <yosryahmed@google.com> wrote:
> > - Fix a subtle bug where updating a local counter would be missed if it
> > was cancelled out by a pending update from child memcgs.
>
>
> Johannes, I fixed a subtle bug here and I kept your Ack, I wasn't sure
> what the Ack retention policy should be here. A quick look at the fix
> would be great.
Ah, I found it:
> > @@ -5542,19 +5539,23 @@ static void mem_cgroup_css_rstat_flush(struct cgroup_subsys_state *css, int cpu)
> > memcg->vmstats->state_pending[i] = 0;
> >
> > /* Add CPU changes on this level since the last flush */
> > + delta_cpu = 0;
> > v = READ_ONCE(statc->state[i]);
> > if (v != statc->state_prev[i]) {
> > - delta += v - statc->state_prev[i];
> > + delta_cpu = v - statc->state_prev[i];
> > + delta += delta_cpu;
> > statc->state_prev[i] = v;
> > }
> >
> > - if (!delta)
> > - continue;
> > -
> > /* Aggregate counts on this level and propagate upwards */
> > - memcg->vmstats->state[i] += delta;
> > - if (parent)
> > - parent->vmstats->state_pending[i] += delta;
> > + if (delta_cpu)
> > + memcg->vmstats->state_local[i] += delta_cpu;
When delta nulls out, but delta_cpu is non-zero... subtle.
This fixed version looks good, please keep my ack :)
next prev parent reply other threads:[~2023-07-26 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 0:29 [PATCH] " Yosry Ahmed
2023-07-26 0:29 ` [PATCH v2] " Yosry Ahmed
2023-07-26 0:36 ` Yosry Ahmed
2023-07-26 15:13 ` Johannes Weiner [this message]
2023-07-26 15:14 ` Yosry Ahmed
2023-07-26 2:15 ` Roman Gushchin
2023-07-26 2:20 ` Yosry Ahmed
2023-07-26 15:20 ` Johannes Weiner
2023-07-26 15:23 ` 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=20230726151315.GB1365610@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--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