From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Harry Yoo" <harry@kernel.org>
Cc: "Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Hocko" <mhocko@kernel.org>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Muchun Song" <muchun.song@linux.dev>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Hao Li" <hao.li@linux.dev>, "Christoph Lameter" <cl@gentwo.org>,
"David Rientjes" <rientjes@google.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Clark Williams" <clrkwllms@kernel.org>,
"Steven Rostedt" <rostedt@goodmis.org>, <kernel-team@meta.com>,
<cgroups@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <linux-rt-devel@lists.linux.dev>,
"Sashiko" <sashiko-bot@kernel.org>
Subject: Re: [PATCH for-next-fixes v2 4/5] mm/slab: fix a deadlock in memcg_alloc_abort_single()
Date: Tue, 03 Nov 2026 21:11:03 +0000 [thread overview]
Message-ID: <DMLVUTB5J1RJ.2QKOUW6UB04ZM@gmail.com> (raw)
In-Reply-To: <auo5G__ac1qA9JRs@thinkstation>
On Tue, Nov 03, 2026 at 12:21 PM Harry Yoo <harry@kernel.org> wrote:
> While this is technically true, this relies too much on the current
> implementation details and makes the code hard to follow.
Fair enough. I don't insist.
> Patch 2 is an independent bugfix as-is already. We should really stop
> open-coding slab_free_hook(). That ended up missing init_on_free handing.
Right. No objection to patch 2.
With patches 2 and 3 the !allow_spin side of memcg_alloc_abort_single()
is an open coded kfree_nolock():
kfree_nolock() memcg_alloc_abort_single(!allow_spin)
-------------------------------- -------------------------------------
memcg_slab_free_hook() -
alloc_tagging_slab_free_hook() alloc_tagging_slab_free_hook()
slab_free_hook(!allow_spin) slab_free_hook(!allow_spin)
free_to_pcs() -
defer_free() defer_free()
I don't insist on kfree_nolock() there,
but can we try free_to_pcs() before defer_free() ?
Like:
if (likely(allow_spin))
__slab_free(s, slab, object, object, 1, _RET_IP_);
else if (!can_free_to_pcs(slab) || !free_to_pcs(s, object, false))
defer_free(s, object);
next prev parent reply other threads:[~2026-11-03 21:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 14:47 [PATCH for-next-fixes v2 0/5] memcg,slab: kmalloc_nolock() fixes Harry Yoo (Meta)
2026-11-03 14:47 ` [PATCH for-next-fixes v2 1/5] mm/memcontrol: defer obj_cgroup_release() to irq_work Harry Yoo (Meta)
2026-11-04 11:02 ` Vlastimil Babka (SUSE)
2026-11-04 12:00 ` Harry Yoo
2026-11-03 14:47 ` [PATCH for-next-fixes v2 2/5] mm/slab: handle allow_spin in slab_free_hook() instead of open coding Harry Yoo (Meta)
2026-11-04 13:54 ` Vlastimil Babka (SUSE)
2026-11-05 12:09 ` Harry Yoo
2026-11-03 14:47 ` [PATCH for-next-fixes v2 3/5] mm/slab: call debug_locks and KCSAN checks in kfree_nolock() Harry Yoo (Meta)
2026-11-03 14:47 ` [PATCH for-next-fixes v2 4/5] mm/slab: fix a deadlock in memcg_alloc_abort_single() Harry Yoo (Meta)
2026-11-03 18:40 ` Alexei Starovoitov
2026-11-03 20:21 ` Harry Yoo
2026-11-03 21:11 ` Alexei Starovoitov [this message]
2026-11-04 15:35 ` Vlastimil Babka (SUSE)
2026-11-04 16:46 ` Alexei Starovoitov
2026-11-03 14:47 ` [PATCH for-next-fixes v2 5/5] mm/slab: serialize deferred_work_barrier() Harry Yoo (Meta)
2026-11-04 16:24 ` Vlastimil Babka (SUSE)
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=DMLVUTB5J1RJ.2QKOUW6UB04ZM@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=cl@gentwo.org \
--cc=clrkwllms@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=sashiko-bot@kernel.org \
--cc=shakeel.butt@linux.dev \
--cc=vbabka@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.