All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Longlong Xia <xialonglong2025@163.com>
Cc: Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
	linux-mm@kvack.org, Longlong Xia <xialonglong@kylinos.cn>,
	stable@vger.kernel.org, sashiko@lists.linux.dev
Subject: Re: [PATCH] mm/swap: publish cluster tables after full initialization
Date: Thu, 13 Aug 2026 12:23:02 -0700	[thread overview]
Message-ID: <20260813122302.516f19c013a25968e7dae741@linux-foundation.org> (raw)
In-Reply-To: <20260813150316.2793642-1-xialonglong2025@163.com>

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.




  reply	other threads:[~2026-08-13 19:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 15:03 [PATCH] mm/swap: publish cluster tables after full initialization Longlong Xia
2026-08-13 19:23 ` Andrew Morton [this message]
2026-08-14  1:46 ` Youngjun Park
2026-08-14  2:35 ` Kairui Song
2026-08-14  2:55   ` Longlong Xia

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=20260813122302.516f19c013a25968e7dae741@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=sashiko@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=xialonglong2025@163.com \
    --cc=xialonglong@kylinos.cn \
    /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.