From: Chris Li <chrisl@kernel.org>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeelb@google.com>,
Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
android-mm@google.com, Minchan Kim <minchan@google.com>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mm: memcg: Don't periodically flush stats when memcg is disabled
Date: Fri, 26 Jan 2024 13:28:23 -0800 [thread overview]
Message-ID: <CAF8kJuPLS_1m0=4vmV8fyrQ5N6yCt-2eufBkBSF=nECsb3pU2Q@mail.gmail.com> (raw)
In-Reply-To: <20240126211927.1171338-1-tjmercier@google.com>
Hi T.J.
Acked-by: Chris Li <chrisl@kernel.org>
Chris
On Fri, Jan 26, 2024 at 1:19 PM T.J. Mercier <tjmercier@google.com> wrote:
>
> The root memcg is onlined even when memcg is disabled. When it's onlined
> a 2 second periodic stat flush is started, but no stat flushing is
> required when memcg is disabled because there can be no child memcgs.
> Most calls to flush memcg stats are avoided when memcg is disabled as a
> result of the mem_cgroup_disabled check added in 7d7ef0a4686a
> ("mm: memcg: restore subtree stats flushing"), but the periodic flushing
> started in mem_cgroup_css_online is not. Skip it.
>
> Fixes: aa48e47e3906 ("memcg: infrastructure to flush memcg stats")
> Reported-by: Minchan Kim <minchan@google.com>
> Signed-off-by: T.J. Mercier <tjmercier@google.com>
> Acked-by: Shakeel Butt <shakeelb@google.com>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index e4c8735e7c85..bad8f9dfc9ab 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -5586,7 +5586,7 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
> if (alloc_shrinker_info(memcg))
> goto offline_kmem;
>
> - if (unlikely(mem_cgroup_is_root(memcg)))
> + if (unlikely(mem_cgroup_is_root(memcg)) && !mem_cgroup_disabled())
> queue_delayed_work(system_unbound_wq, &stats_flush_dwork,
> FLUSH_TIME);
> lru_gen_online_memcg(memcg);
> --
> 2.43.0.429.g432eaa2c6b-goog
>
>
next prev parent reply other threads:[~2024-01-26 21:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 21:19 [PATCH v2] mm: memcg: Don't periodically flush stats when memcg is disabled T.J. Mercier
2024-01-26 21:28 ` Chris Li [this message]
2024-01-29 20:32 ` Yosry Ahmed
2024-02-01 14:26 ` Michal Koutný
2024-02-01 21:02 ` T.J. Mercier
2024-02-02 22:39 ` Michal Koutný
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='CAF8kJuPLS_1m0=4vmV8fyrQ5N6yCt-2eufBkBSF=nECsb3pU2Q@mail.gmail.com' \
--to=chrisl@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=android-mm@google.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=minchan@google.com \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeelb@google.com \
--cc=tjmercier@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;
as well as URLs for NNTP newsgroup(s).