linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chris Li <chrisl@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: Baoquan He <bhe@redhat.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	 kasong@tencent.com, youngjun.park@lge.com, aaron.lu@intel.com,
	 shikemeng@huaweicloud.com, nphamcs@gmail.com
Subject: Re: [PATCH v4 mm-new 2/2] mm/swap: select swap device with default priority round robin
Date: Tue, 14 Oct 2025 23:24:48 -0700	[thread overview]
Message-ID: <CACePvbUa6T=gEpY7yCOwTL0m7Jum6eiBh-OAmdq2+BPjo-YSoA@mail.gmail.com> (raw)
In-Reply-To: <CAGsJ_4zzLYyGDuZbMU2j2nqatjLi1kP_eJ8XA3eA1UqN3JgWvw@mail.gmail.com>

On Tue, Oct 14, 2025 at 9:29 PM Barry Song <21cnbao@gmail.com> wrote:
>
> On Wed, Oct 15, 2025 at 6:49 AM Chris Li <chrisl@kernel.org> wrote:
> >
> > On Sun, Oct 12, 2025 at 11:17 PM Barry Song <21cnbao@gmail.com> wrote:
> > > >
> > > > However, after commit a2468cc9bfdf applied, above behaviour had been
> > > > changed. I can give an extreme example, imagine on a system with one
> > > > NUMA Node, node_id is 0. Then I swapon several swap devices w/o node_id
> > > > value (namely node_id is -1), at last I swapon one device with node_id
> > > > 0. You can see the last one will have the highest priority to be chosen,
> > > > then other swap devices.
> > >
> > > I assume this adds logic to prefer swapping to the closer swapfile first,
> > > while still maintaining the old behavior for non-NUMA cases.
> >
> > That commit a2468cc9bfdf changes the default behavior of the swapon
> > which does not specify a priority.
> > If you claim the revert breaks the user behavior, that commit also
> > breaks the user behavior as well.
> >
> > > > So I would argue that if people realy care about the default priority,
> > > > it has been broken since 2017 when commit a2468cc9bfdf was introduce,
> > > > and complaint would be heard since long before. While we didn't hear
> > > > complaint, means the default priority doesn't really matter?
> > > > >
> > > > > Or if someone sets up Linux assuming that a newer swap file will only be
> > > > > used after the older one is full, then this change would break those cases?
> > > >
> > > > Hmm, it could happen, but I doubt people really count on that. I would use
> > > > 'swapon -p xx' to specify explicit priority to make sure it. In the case you
> > > > said, swapped out pages will be swapped in, it's either not guaranteed.
> > >
> > > Personally, I also dislike the behavior where a newer swap file
> > > automatically gets a lower priority than an older one. However, since
> > > we have a rule to never break userspace, is this considered such a
> > > case? Or at least, do we need to update the man page as well?
> >
> > See above, we should update the man page as well.
> >
> > If the a2468cc9bfdf can break user default swapon behavior by
> > introducing node_id in the first place. It is totally justifiable to
> > break it again to revert it. I fail to see the logic why the breaking
> > rule only applies to the revert but not the commit introducing it in
> > the first place.
>
> I’m actually referring to the part below, which changes the default priority
> to -1 for all swapfiles while it used to be -n, -n -1, -n -2 , -n -3....
>
> -       if (prio >= 0)
> -               si->prio = prio;
> -       else
> -               si->prio = --least_priority;
>
> I agree the NUMA-ID swap patch (a2468cc9bfdf) has partially broken the man
> page, but only for very rare hardware whose block device has a NUMA node ID
> (yes, the man page should have been updated back then). Now we’re breaking
> the man page for all hardware, so I think it’s even more important to
> highlight that in the man page at this point.

Right, I think we are in agreement that the man page needs to be
updated as well. Thanks for catching that.

Chris


  reply	other threads:[~2025-10-15  6:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11  8:16 [PATCH v4 mm-new 0/2] mm/swapfile.c: select the " Baoquan He
2025-10-11  8:16 ` [PATCH v4 mm-new 1/2] mm/swap: do not choose swap device according to numa node Baoquan He
2025-10-11 20:45   ` kernel test robot
2025-10-11 22:04     ` Andrew Morton
2025-10-12  2:08       ` Baoquan He
2025-10-14 11:56       ` Baoquan He
2025-10-13  6:09   ` Barry Song
2025-10-14 21:50     ` Chris Li
2025-10-15  3:06     ` Baoquan He
2025-10-15  5:02       ` Barry Song
2025-10-15  6:23         ` Chris Li
2025-10-15  8:09           ` Barry Song
2025-10-15 13:27             ` Chris Li
2025-10-11  8:16 ` [PATCH v4 mm-new 2/2] mm/swap: select swap device with default priority round robin Baoquan He
2025-10-12 20:40   ` Barry Song
2025-10-13  3:58     ` Baoquan He
2025-10-13  6:17       ` Barry Song
2025-10-13 23:07         ` Baoquan He
2025-10-14 22:11         ` Chris Li
2025-10-15  4:29           ` Barry Song
2025-10-15  6:24             ` Chris Li [this message]
2025-10-14 22:01     ` Chris Li

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='CACePvbUa6T=gEpY7yCOwTL0m7Jum6eiBh-OAmdq2+BPjo-YSoA@mail.gmail.com' \
    --to=chrisl@kernel.org \
    --cc=21cnbao@gmail.com \
    --cc=aaron.lu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=youngjun.park@lge.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