From: Michal Hocko <mhocko@suse.com>
To: "T.J. Mercier" <tjmercier@google.com>
Cc: hannes@cmpxchg.org, roman.gushchin@linux.dev,
shakeel.butt@linux.dev, muchun.song@linux.dev,
zhengqi.arch@bytedance.com, akpm@linux-foundation.org,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] mm: memcontrol: fix NULL pointer deref in high_work_func() on dying memcg
Date: Mon, 26 Oct 2026 14:25:44 +0100 [thread overview]
Message-ID: <at9U2HvyUP-iYOCt@tiehlicka> (raw)
In-Reply-To: <20261023222313.3979455-1-tjmercier@google.com>
On Fri 23-10-26 15:23:13, T.J. Mercier wrote:
[...]
> ---
> mm/memcontrol.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index a05d9a8baa1b..84f4a8fd4d16 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2457,7 +2457,10 @@ static void high_work_func(struct work_struct *work)
> struct mem_cgroup *memcg;
>
> memcg = container_of(work, struct mem_cgroup, high_work);
> + if (!css_tryget_online(&memcg->css))
> + return;
> reclaim_high(memcg, MEMCG_CHARGE_BATCH, GFP_KERNEL);
> + css_put(&memcg->css);
> }
OK.
> static void high_irq_work_func(struct irq_work *work)
> @@ -4463,6 +4466,8 @@ static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
>
> page_counter_set_min(&memcg->memory, 0);
> page_counter_set_low(&memcg->memory, 0);
> + page_counter_set_high(&memcg->memory, PAGE_COUNTER_MAX);
> + page_counter_set_high(&memcg->swap, PAGE_COUNTER_MAX);
>
> zswap_memcg_offline_cleanup(memcg);
Should we simply disable_work_sync when the memcg is going to be
released instead (mem_cgroup_css_released)? That should both prevent
the run reclaim_high during the memcg shut down and and also avoid
plaing with limits to work around.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2026-10-26 13:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 22:23 T.J. Mercier
2026-10-26 13:25 ` Michal Hocko [this message]
2026-10-26 18:01 ` T.J. Mercier
2026-10-27 9:40 ` Michal Hocko
2026-10-27 17:28 ` T.J. Mercier
2026-10-27 18:07 ` Shakeel Butt
2026-10-27 2:42 ` Muchun Song
2026-10-27 17:42 ` T.J. Mercier
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=at9U2HvyUP-iYOCt@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=tjmercier@google.com \
--cc=zhengqi.arch@bytedance.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
all inboxes | Powered by JetHome®