Skip to content

[Deepin-Kernel-SIG] [linux 6.18.y] [Upstream] [PATCH v5 mm-new 0/2] mm/swapfile.c: select swap devices of default priority round robin#1994

Merged
opsiff merged 3 commits into
deepin-community:linux-6.18.yfrom
opsiff:linux-6.18.y-2026-07-16-swap
Jul 16, 2026
Merged

[Deepin-Kernel-SIG] [linux 6.18.y] [Upstream] [PATCH v5 mm-new 0/2] mm/swapfile.c: select swap devices of default priority round robin#1994
opsiff merged 3 commits into
deepin-community:linux-6.18.yfrom
opsiff:linux-6.18.y-2026-07-16-swap

Conversation

@opsiff

@opsiff opsiff commented Jul 16, 2026

Copy link
Copy Markdown
Member

Link: https://lore.kernel.org/all/[email protected]/T/#u

Currently, on system with multiple swap devices, swap allocation will
select one swap device according to priority. The swap device with the
highest priority will be chosen to allocate firstly.

People can specify a priority from 0 to 32767 when swapon a swap device,
or the system will set it from -2 then downwards by default. Meanwhile,
on NUMA system, the swap device with node_id will be considered first
on that NUMA node of the node_id.

In the current code, an array of plist, swap_avail_heads[nid], is used
to organize swap devices on each NUMA node. For each NUMA node, there
is a plist organizing all swap devices. The 'prio' value in the plist
is the negated value of the device's priority due to plist being sorted
from low to high. The swap device owning one node_id will be promoted to
the front position on that NUMA node, then other swap devices are put in
order of their default priority.

E.g I got a system with 8 NUMA nodes, and I setup 4 zram partition as
swap devices.

Current behaviour:
their priorities will be(note that -1 is skipped):
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 16G 0B -2
/dev/zram1 partition 16G 0B -3
/dev/zram2 partition 16G 0B -4
/dev/zram3 partition 16G 0B -5

And their positions in the 8 swap_avail_lists[nid] will be:
swap_avail_lists[0]: /* node 0's available swap device list /
zram0 -> zram1 -> zram2 -> zram3
prio:1 prio:3 prio:4 prio:5
swap_avali_lists[1]: /
node 1's available swap device list /
zram1 -> zram0 -> zram2 -> zram3
prio:1 prio:2 prio:4 prio:5
swap_avail_lists[2]: /
node 2's available swap device list /
zram2 -> zram0 -> zram1 -> zram3
prio:1 prio:2 prio:3 prio:5
swap_avail_lists[3]: /
node 3's available swap device list /
zram3 -> zram0 -> zram1 -> zram2
prio:1 prio:2 prio:3 prio:4
swap_avail_lists[4-7]: /
node 4,5,6,7's available swap device list */
zram0 -> zram1 -> zram2 -> zram3
prio:2 prio:3 prio:4 prio:5

The adjustment for swap device with node_id intended to decrease the
pressure of lock contention for one swap device by taking different
swap device on different node. The adjustment was introduced in commit
a2468cc ("swap: choose swap device according to numa node").
However, the adjustment is a little coarse-grained. On the node, the swap
device sharing the node's id will always be selected firstly by node's CPUs
until exhausted, then next one. And on other nodes where no swap device
shares its node id, swap device with priority '-2' will be selected firstly
until exhausted, then next with priority '-3'.

This is the swapon output during the process high pressure vm-scability
test is being taken. It's clearly showing zram0 is heavily exploited until
exhausted.

===================================
[root@hp-dl385g10-03 ~]# swapon
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 16G 15.7G -2
/dev/zram1 partition 16G 3.4G -3
/dev/zram2 partition 16G 3.4G -4
/dev/zram3 partition 16G 2.6G -5

The node based strategy on selecting swap device is much better then the
old way one by one selecting swap device. However it is still unreasonable
because swap devices are assumed to have similar accessing speed if no
priority is specified when swapon. It's unfair and doesn't make sense just
because one swap device is swapped on firstly, its priority will be higher
than the one swapped on later.

So in this patchset, change is made to select the swap device round robin
if default priority. In code, the plist array swap_avail_heads[nid] is replaced
with a plist swap_avail_head which reverts commit a2468cc. Meanwhile,
on top of the revert, further change is taken to make any device w/o
specified priority get the same default priority '-1'. Surely, swap device
with specified priority are always put foremost, this is not impacted. If
you care about their different accessing speed, then use 'swapon -p xx' to
deploy priority for your swap devices.

New behaviour:

swap_avail_list: /* one global available swap device list */
zram0 -> zram1 -> zram2 -> zram3
prio:1 prio:1 prio:1 prio:1

This is the swapon output during the process high pressure vm-scability
being taken, all is selected round robin:

[root@hp-dl385g10-03 linux]# swapon
NAME TYPE SIZE USED PRIO
/dev/zram0 partition 16G 12.6G -1
/dev/zram1 partition 16G 12.6G -1
/dev/zram2 partition 16G 12.6G -1
/dev/zram3 partition 16G 12.6G -1

With the change, we can see about 18% efficiency promotion as below:

vm-scability test:

Test with:
usemem --init-time -O -y -x -n 31 2G (4G memcg, zram as swap)
Before: After:
System time: 637.92 s 526.74 s (lower is better)
Sum Throughput: 3546.56 MB/s 4207.56 MB/s (higher is better)
Single process Throughput: 114.40 MB/s 135.72 MB/s (higher is better)
free latency: 10138455.99 us 6810119.01 us (low is better)

Changelog:

v4->v5:

  • Rebase on the latest mm-new;
  • Clean up the relics of swap_numa in Documentation/admin-guide/mm/index.rst.

v3->v4:

  • Rebase on the latest mm-new;
  • Add Chris's Suggested-by and Acked-by.

v2->v3:

  • Split the v2 patch into two parts, one is reverting commit
    a2468cc, the 2nd is making change to set default priority as -1
    for all swap devices which makes swapping out select swap device round
    robin. This eases patch reviewing which is suggested by Chris, thanks.
  • Fix a LKP reported issue I mistakenly added other debugging code into
    v2 patch. clean that up.

v1->v2:

  • Remove Documentation/admin-guide/mm/swap_numa.rst;
  • Add back mistakenly removed lockdep_assert_held() line;
  • Remove the unneeded code comment in _enable_swap_info().
    Thanks a lot for careful reviewing from Chris, YoungJun and Kairui.

Baoquan He (2):
mm/swap: do not choose swap device according to numa node
mm/swap: select swap device with default priority round robin

Documentation/admin-guide/mm/index.rst | 1 -
Documentation/admin-guide/mm/swap_numa.rst | 78 ---------------
include/linux/swap.h | 11 +--
mm/swapfile.c | 106 ++++-----------------
4 files changed, 17 insertions(+), 179 deletions(-)
delete mode 100644 Documentation/admin-guide/mm/swap_numa.rst

--
2.41.0

Summary by Sourcery

Revert NUMA-based swap device selection and introduce round-robin allocation among swap devices with the default priority, simplifying swap availability tracking to a single global list.

New Features:

  • Select swap devices with the default priority in a round-robin fashion to balance swap usage across devices.

Enhancements:

  • Replace per-NUMA-node swap availability lists with a single global plist head for simpler and more uniform swap device selection.
  • Define a single default swap priority constant and apply it to devices that do not specify an explicit priority, avoiding implicit ordering based on swapon time.

Documentation:

  • Remove the swap_numa documentation and its index entry to reflect the deprecation of NUMA-aware swap device selection behavior.

Baoquan He and others added 3 commits July 16, 2026 15:22
mainline inclusion
from mainline-v6.19-rc1
category: performance

Patch series "mm/swapfile.c: select swap devices of default priority round
robin", v5.

Currently, on system with multiple swap devices, swap allocation will
select one swap device according to priority.  The swap device with the
highest priority will be chosen to allocate firstly.

People can specify a priority from 0 to 32767 when swapon a swap device,
or the system will set it from -2 then downwards by default.  Meanwhile,
on NUMA system, the swap device with node_id will be considered first on
that NUMA node of the node_id.

In the current code, an array of plist, swap_avail_heads[nid], is used to
organize swap devices on each NUMA node.  For each NUMA node, there is a
plist organizing all swap devices.  The 'prio' value in the plist is the
negated value of the device's priority due to plist being sorted from low
to high.  The swap device owning one node_id will be promoted to the front
position on that NUMA node, then other swap devices are put in order of
their default priority.

E.g I got a system with 8 NUMA nodes, and I setup 4 zram partition as
swap devices.

Current behaviour:
their priorities will be(note that -1 is skipped):
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition  16G   0B   -2
/dev/zram1 partition  16G   0B   -3
/dev/zram2 partition  16G   0B   -4
/dev/zram3 partition  16G   0B   -5

And their positions in the 8 swap_avail_lists[nid] will be:
swap_avail_lists[0]: /* node 0's available swap device list */
zram0   -> zram1   -> zram2   -> zram3
prio:1     prio:3     prio:4     prio:5
swap_avali_lists[1]: /* node 1's available swap device list */
zram1   -> zram0   -> zram2   -> zram3
prio:1     prio:2     prio:4     prio:5
swap_avail_lists[2]: /* node 2's available swap device list */
zram2   -> zram0   -> zram1   -> zram3
prio:1     prio:2     prio:3     prio:5
swap_avail_lists[3]: /* node 3's available swap device list */
zram3   -> zram0   -> zram1   -> zram2
prio:1     prio:2     prio:3     prio:4
swap_avail_lists[4-7]: /* node 4,5,6,7's available swap device list */
zram0   -> zram1   -> zram2   -> zram3
prio:2     prio:3     prio:4     prio:5

The adjustment for swap device with node_id intended to decrease the
pressure of lock contention for one swap device by taking different swap
device on different node.  The adjustment was introduced in commit
a2468cc ("swap: choose swap device according to numa node").
However, the adjustment is a little coarse-grained.  On the node, the swap
device sharing the node's id will always be selected firstly by node's
CPUs until exhausted, then next one.  And on other nodes where no swap
device shares its node id, swap device with priority '-2' will be selected
firstly until exhausted, then next with priority '-3'.

This is the swapon output during the process high pressure vm-scability
test is being taken.  It's clearly showing zram0 is heavily exploited
until exhausted.

===================================
[root@hp-dl385g10-03 ~]# swapon
NAME       TYPE      SIZE  USED PRIO
/dev/zram0 partition  16G 15.7G   -2
/dev/zram1 partition  16G  3.4G   -3
/dev/zram2 partition  16G  3.4G   -4
/dev/zram3 partition  16G  2.6G   -5

The node based strategy on selecting swap device is much better then the
old way one by one selecting swap device.  However it is still
unreasonable because swap devices are assumed to have similar accessing
speed if no priority is specified when swapon.  It's unfair and doesn't
make sense just because one swap device is swapped on firstly, its
priority will be higher than the one swapped on later.

So in this patchset, change is made to select the swap device round robin
if default priority.  In code, the plist array swap_avail_heads[nid] is
replaced with a plist swap_avail_head which reverts commit a2468cc.
Meanwhile, on top of the revert, further change is taken to make any
device w/o specified priority get the same default priority '-1'.  Surely,
swap device with specified priority are always put foremost, this is not
impacted.  If you care about their different accessing speed, then use
'swapon -p xx' to deploy priority for your swap devices.

New behaviour:

swap_avail_list: /* one global available swap device list */
zram0   -> zram1   -> zram2   -> zram3
prio:1     prio:1     prio:1     prio:1

This is the swapon output during the process high pressure vm-scability
being taken, all is selected round robin:
=======================================
[root@hp-dl385g10-03 linux]# swapon
NAME       TYPE      SIZE  USED PRIO
/dev/zram0 partition  16G 12.6G   -1
/dev/zram1 partition  16G 12.6G   -1
/dev/zram2 partition  16G 12.6G   -1
/dev/zram3 partition  16G 12.6G   -1

With the change, we can see about 18% efficiency promotion as below:

vm-scability test:
==================
Test with:
usemem --init-time -O -y -x -n 31 2G (4G memcg, zram as swap)
                           Before:          After:
System time:               637.92 s         526.74 s      (lower is better)
Sum Throughput:            3546.56 MB/s     4207.56 MB/s  (higher is better)
Single process Throughput: 114.40 MB/s      135.72 MB/s   (higher is better)
free latency:              10138455.99 us   6810119.01 us (low is better)

This patch (of 2):

This reverts commit a2468cc ("swap: choose swap device according to
numa node").

After this patch, the behaviour will change back to pre-commit
a2468cc.  Means the priority will be set from -1 then downwards by
default, and when swapping, it will exhault swap device one by one
according to priority from high to low.  This is preparation work for
later change.

[root@hp-dl385g10-03 ~]# swapon
NAME       TYPE      SIZE   USED PRIO
/dev/zram0 partition  16G    16G   -1
/dev/zram1 partition  16G 966.2M   -2
/dev/zram2 partition  16G     0B   -3
/dev/zram3 partition  16G     0B   -4

Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Baoquan He <[email protected]>
Suggested-by: Chris Li <[email protected]>
Acked-by: Chris Li <[email protected]>
Acked-by: Nhat Pham <[email protected]>
Reviewed-by: Kairui Song <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Kemeng Shi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
(cherry picked from commit 8e689f8)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
from mainline-v6.19-rc1
category: performance

Swap devices are assumed to have similar accessing speed when swapon if no
priority is specified.  It's unfair and doesn't make sense just because
one swap device is swapped on firstly, its priority will be higher than
the one swapped on later.

Here, set all swap devicess to have priority '-1' by default.  With this
change, swap device with default priority will be selected round robin
when swapping out.  This can improve the swapping efficiency a lot among
multiple swap devices with default priority.

Below are swapon output during the processes when high pressure
vm-scability test is being taken:

1) This is pre-commit a2468cc, swap device is selectd one by one by
   priority from high to low when one swap device is exhausted:
------------------------------------
[root@hp-dl385g10-03 ~]# swapon
NAME       TYPE      SIZE   USED PRIO
/dev/zram0 partition  16G    16G   -1
/dev/zram1 partition  16G 966.2M   -2
/dev/zram2 partition  16G     0B   -3
/dev/zram3 partition  16G     0B   -4

2) This is behaviour with commit a2468cc, on node, swap device
   sharing the same node id is selected firstly until exhausted; while
   on node no swap device sharing the node id it selects the one with
   highest priority until exhaustd:
------------------------------------
[root@hp-dl385g10-03 ~]# swapon
NAME       TYPE      SIZE  USED PRIO
/dev/zram0 partition  16G 15.7G   -2
/dev/zram1 partition  16G  3.4G   -3
/dev/zram2 partition  16G  3.4G   -4
/dev/zram3 partition  16G  2.6G   -5

3) After this patch applied, swap devices with default priority are selectd
   round robin:
------------------------------------
[root@hp-dl385g10-03 block]# swapon
NAME       TYPE      SIZE USED PRIO
/dev/zram0 partition  16G 6.6G   -1
/dev/zram1 partition  16G 6.6G   -1
/dev/zram2 partition  16G 6.6G   -1
/dev/zram3 partition  16G 6.6G   -1

With the change, about 18% efficiency promotion relative to node based
way as below. (Surely, the pre-commit a2468cc way is the worst.)

vm-scability test:
==================
Test with:
usemem --init-time -O -y -x -n 31 2G (4G memcg, zram as swap)
                            one by one:      node based:      round robin:
System time:                1087.38 s        637.92 s         526.74 s     (lower is better)
Sum Throughput:             2036.55 MB/s     3546.56 MB/s     4207.56 MB/s (higher is better)
Single process Throughput:  65.69 MB/s       114.40 MB/s      135.72 MB/s  (high is better)
free latency:               15769409.48 us   10138455.99 us   6810119.01 us(lower is better)

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Baoquan He <[email protected]>
Suggested-by: Chris Li <[email protected]>
Acked-by: Chris Li <[email protected]>
Acked-by: Nhat Pham <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Kairui Song <[email protected]>
Cc: Kemeng Shi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
(cherry picked from commit 52f37ef)
Signed-off-by: Wentao Guan <[email protected]>
mainline inclusion
from mainline-v6.19-rc1
category: bugfix

swap_alloc_slow() was checking `si->avail_list` instead of
`next->avail_list` when verifying if the next swap device is still in the
list, which could cause unnecessary restarts during allocation.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: 8e689f8 ("mm/swap: do not choose swap device according to numa node")
Signed-off-by: Youngjun Park <[email protected]>
Acked-by: Kairui Song <[email protected]>
Reviewed-by: Baoquan He <[email protected]>
Cc: Barry Song <[email protected]>
Cc: Chris Li <[email protected]>
Cc: Kemeng Shi <[email protected]>
Cc: Nhat Pham <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
(cherry picked from commit c230719)
Signed-off-by: Wentao Guan <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR reverts NUMA-aware per-node swap device selection and replaces it with a single global priority-ordered list, then standardizes the default swap priority to -1 so that multiple devices with default priority are selected round robin, while still honoring explicitly configured priorities.

Sequence diagram for global round-robin swap device selection

sequenceDiagram
    participant Process
    participant mm as mm_swapfile
    participant head as swap_avail_head
    participant si as swap_info_struct

    Process->>mm: swapon(specialfile, swap_flags)
    mm->>mm: alloc_swap_info()
    mm->>mm: setup_swap_info(si, prio)
    note over mm: prio = DEF_SWAP_PRIO unless SWAP_FLAG_PREFER
    mm->>mm: enable_swap_info(si, prio, ...)
    mm->>mm: add_to_avail_list(si, true)
    mm->>head: plist_add(si.avail_list, swap_avail_head)

    Process->>mm: folio_alloc_swap(...)
    mm->>mm: swap_alloc_slow(entry, order)
    mm->>head: plist_for_each_entry_safe(si, next, swap_avail_head, avail_list)
    mm->>head: plist_requeue(si.avail_list, swap_avail_head)
    mm->>mm: cluster_alloc_swap_entry(si, order, SWAP_HAS_CACHE)
    mm-->>Process: swap entry allocated round robin across default-priority devices
Loading

File-Level Changes

Change Details Files
Replace per-NUMA swap availability lists with a single global plist and remove NUMA-based swap device selection.
  • Remove swap_avail_heads array and related NUMA initialization logic, introduce a single swap_avail_head plist protected by swap_avail_lock.
  • Change swap_info_struct to store a single avail_list node instead of a flexible array of per-node avail_lists, simplifying allocation and initialization of swap_info_struct.
  • Update helpers that add/remove devices from the available list (add_to_avail_list, del_from_avail_list, __folio_throttle_swaprate, swap_alloc_slow, swap_sync_discard) to operate on the global list instead of selecting by current or folio NUMA node.
  • Delete swap_node() logic and the per-node priority tweaking that favored devices whose block device node_id matched the NUMA node, effectively reverting commit a2468cc.
  • Remove dynamic allocation and initialization of swap_avail_heads in swapfile_init and the corresponding early ENOMEM failure path in swapon.
mm/swapfile.c
include/linux/swap.h
Standardize default swap priority to -1 for all devices and rely on plist ordering for round-robin allocation among equal-priority devices.
  • Introduce DEF_SWAP_PRIO macro set to -1 and use it when computing the default prio in swapon, instead of decrementing a global least_priority counter.
  • Simplify setup_swap_info() to take the computed prio directly, drop least_priority-based auto-decrement and per-node special prio handling, and set list and avail_list priorities to the negated prio for plist ordering.
  • Remove swapoff() logic that renormalized negative priorities (incrementing prio and adjusting plist prio for remaining devices), since priorities are now stable and non-decrementing.
  • Ensure swap allocation paths (swap_alloc_slow, folio_alloc_swap via swap_avail_head) naturally perform round robin among equal-priority devices by requeueing the chosen device in the global plist.
  • Keep behavior that devices with explicit positive priorities remain ordered ahead of default-priority devices, preserving admin-controlled performance tuning via swapon -p.
mm/swapfile.c
Drop NUMA-specific swap documentation that described the removed per-node behavior.
  • Remove Documentation/admin-guide/mm/swap_numa.rst which documented NUMA-aware swap device selection.
  • Clean up the mm admin guide index by dropping the swap_numa entry, aligning documentation with the simplified global swap device selection policy.
Documentation/admin-guide/mm/index.rst
Documentation/admin-guide/mm/swap_numa.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
deepin-ci-robot requested a review from BLumia July 16, 2026 07:25
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The removal of per-node swap_avail_heads and swap_node() changes NUMA-aware behavior significantly; consider adding a brief code comment near swap_alloc_slow explaining that the allocation is now intentionally NUMA-unaware to avoid future confusion or accidental reintroduction.
  • Since least_priority and the auto-adjustment of negative priorities on swapoff are gone, review mixed-priority scenarios to ensure the new DEF_SWAP_PRIO handling still matches intended ordering when devices with explicit priorities coexist with default-priority ones, and clarify that behavior in the priority assignment code.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The removal of per-node swap_avail_heads and swap_node() changes NUMA-aware behavior significantly; consider adding a brief code comment near swap_alloc_slow explaining that the allocation is now intentionally NUMA-unaware to avoid future confusion or accidental reintroduction.
- Since least_priority and the auto-adjustment of negative priorities on swapoff are gone, review mixed-priority scenarios to ensure the new DEF_SWAP_PRIO handling still matches intended ordering when devices with explicit priorities coexist with default-priority ones, and clarify that behavior in the priority assignment code.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the swap device selection policy to stop using NUMA-node-specific available lists and instead perform round-robin selection among swap devices that have the default (auto) priority, while keeping explicitly assigned priorities ordered ahead as before.

Changes:

  • Replace per-NUMA-node swap_avail_heads[] tracking with a single global swap_avail_head list.
  • Assign a uniform default swap priority (-1) so default-priority devices are selected round-robin rather than “first swapon wins”.
  • Remove NUMA swap selection documentation and its index entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
mm/swapfile.c Switches swap availability tracking to a single global plist and adjusts swap allocation/rotation accordingly.
include/linux/swap.h Simplifies swap_info_struct by replacing the per-node avail_lists[] array with a single avail_list node.
Documentation/admin-guide/mm/swap_numa.rst Removes documentation for the NUMA-based swap selection behavior.
Documentation/admin-guide/mm/index.rst Drops the swap_numa entry from the MM documentation index.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 39 to 43
shrinker_debugfs
slab
soft-dirty
swap_numa
transhuge
userfaultfd
@opsiff
opsiff merged commit 2f203a4 into deepin-community:linux-6.18.y Jul 16, 2026
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants