* Re: [PATCH] mm/swap: publish cluster tables after full initialization
[not found] <20260813150316.2793642-1-xialonglong2025@163.com>
@ 2026-08-13 19:23 ` Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-13 19:23 UTC (permalink / raw)
To: Longlong Xia
Cc: Chris Li, Kairui Song, linux-mm, Longlong Xia, stable, sashiko
On Thu, 13 Aug 2026 23:03:16 +0800 Longlong Xia <xialonglong2025@163.com> wrote:
> From: Longlong Xia <xialonglong@kylinos.cn>
>
> swap_cluster_populate() drops the local, global, and cluster locks
> before its sleeping allocation. The allocation helper publishes ci->table
> before allocating the memcg table and, on some 32-bit configurations, the
> zero bitmap.
>
> A stale per-CPU or global cluster cursor can reach the isolated cluster in
> that window. Since CLUSTER_FLAG_NONE and a non-NULL table make the cluster
> appear usable, it can allocate a slot without the auxiliary state. An
> auxiliary allocation failure can then tear down a table which is already in
> use.
>
> Allocate the complete set of tables into a private carrier. Install the
> auxiliary pointers and publish the main table only while holding ci->lock;
> the slow path does this after reacquiring all allocator locks. Allocation
> failures now free only unpublished resources.
This is a complex patch, for a problem which I'm assuming nobody has
ever encountered.
> Fixes: b197d41462c2 ("mm/memcg, swap: store cgroup id in cluster table directly")
For the eleven thousandth time (I'm not blaming you - this is endemic).
When fixing a bug, please fully describe the userspace-visible runtime
effects of this bug.
If there is a report then document this. If there is a testcase which
triggers this then document it. If there is neither then document
that.
> Cc: stable@vger.kernel.org
Especially when proposing a backport.
Think of the -stable maintainers, and of everyone downstream of them.
They're looking at this thing wondering "should I merge this into my
kernel". We're providing them no reason for doing that! We should do
this. We're the swap experts, aren't we? They depend upon us to
explain these things.
> Assisted-by: Codex:gpt-5.6-sol
Doesn't have a great track record, in my drive-by experience. Sashiko
has found real bugs in things which gpt accepted. And a second opinion
is always welcome.
Sashiko review says "No regressions", but it also says "Status:
Skipped". I cannot figure out what this means. Let me
cc:sashiko@lists.linux.dev. Folks, can you please explain?
https://sashiko.dev/#/patchset/20260813150316.2793642-1-xialonglong2025@163.com
> Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>
Thanks.
> mm/swapfile.c | 167 +++++++++++++++++++++++++++++++++++---------------
I'll take a pass on this and shall await comment from the swap
maintainers. And please understand that it'll be a lot of work for
them, and without that statement of "userspace-visible runtime
effects", their motivation will not be high.
^ permalink raw reply [flat|nested] only message in thread