[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230726151315.GB1365610@cmpxchg.org>
Date: Wed, 26 Jul 2023 11:13:15 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: linux-kernel@...r.kernel.org, Michal Hocko <mhocko@...nel.org>,
cgroups@...r.kernel.org, linux-mm@...ck.org,
Muchun Song <muchun.song@...ux.dev>,
Shakeel Butt <shakeelb@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v2] mm: memcg: use rstat for non-hierarchical stats
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@...gle.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 :)
Powered by blists - more mailing lists