LKML Archive on
help / color / mirror / Atom feed
From: Shakeel Butt <>
To: Andrew Morton <>
Cc: Michal Hocko <>,
	Johannes Weiner <>,
	Roman Gushchin <>, Cgroups <>,
	Linux MM <>,
	LKML <>
Subject: Re: [PATCH] memcg: cleanup racy sum avoidance code
Date: Wed, 28 Jul 2021 13:37:28 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Jul 28, 2021 at 12:43 PM Andrew Morton
<> wrote:
> On Tue, 27 Jul 2021 18:22:43 -0700 Shakeel Butt <> wrote:
> > We used to have per-cpu memcg and lruvec stats and the readers have to
> > traverse and sum the stats from each cpu. This summing was racy and may
> > expose transient negative values. So, an explicit check was added to
> > avoid such scenarios. Now these stats are moved to rstat infrastructure
> > and are no more per-cpu, so we can remove the fixup for transient
> > negative values.
> We can't do anything about the same code in lruvec_page_state_local()?

lruvec_page_state_local() is used by cgroup v1's memory.numa_stat for
cgroup local stats (not hierarchical) and are still per-cpu. To make
it non-per-cpu, we have to add 'long
state_local[NR_VM_NODE_STAT_ITEMS]' in 'struct lruvec_stats' and do
aggregation in rstat flushing. So, paying the cpu traversal cost with
more memory usage. I am not sure if it is worth it.

  reply	other threads:[~2021-07-28 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  1:22 Shakeel Butt
2021-07-28  2:36 ` Roman Gushchin
2021-07-28  8:21 ` David Hildenbrand
2021-07-28 19:43 ` Andrew Morton
2021-07-28 20:37   ` Shakeel Butt [this message]
2021-08-02  6:57 ` Michal Hocko

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] memcg: cleanup racy sum avoidance code' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).