linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nhat Pham <nphamcs@gmail.com>
To: Baoquan He <bhe@redhat.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org, chrisl@kernel.org,
	 youngjun.park@lge.com, kasong@tencent.com, baohua@kernel.org,
	 shikemeng@huaweicloud.com
Subject: Re: [PATCH v5 mm-new 2/2] mm/swap: select swap device with default priority round robin
Date: Tue, 28 Oct 2025 12:56:28 -0700	[thread overview]
Message-ID: <CAKEwX=O3VkZx=4uD2o7dvrv_SdKsD9fcpUyS2YoR7xrdwqjywQ@mail.gmail.com> (raw)
In-Reply-To: <20251028034308.929550-3-bhe@redhat.com>

On Mon, Oct 27, 2025 at 8:43 PM Baoquan He <bhe@redhat.com> wrote:
>
> 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.

Yeah, I agree. In a set up with multiple swap devices, this can spread
out the swap writes, potentially improving throughput.

>
> Below are swapon output during the processes when high pressure vm-scability
> test is being taken:
>
> 1) This is pre-commit a2468cc9bfdf, 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 a2468cc9bfdf, 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 a2468cc9bfdf 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)
>
> Suggested-by: Chris Li <chrisl@kernel.org>
> Acked-by: Chris Li <chrisl@kernel.org>
> Signed-off-by: Baoquan He <bhe@redhat.com>

Acked-by: Nhat Pham <nphamcs@gmail.com>


  reply	other threads:[~2025-10-28 19:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28  3:43 [PATCH v5 mm-new 0/2] mm/swapfile.c: select swap devices of " Baoquan He
2025-10-28  3:43 ` [PATCH v5 mm-new 1/2] mm/swap: do not choose swap device according to numa node Baoquan He
2025-10-28 19:54   ` Nhat Pham
2025-10-28  3:43 ` [PATCH v5 mm-new 2/2] mm/swap: select swap device with default priority round robin Baoquan He
2025-10-28 19:56   ` Nhat Pham [this message]
2025-10-29 15:38 ` [PATCH v5 mm-new 0/2] mm/swapfile.c: select swap devices of " Kairui Song

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='CAKEwX=O3VkZx=4uD2o7dvrv_SdKsD9fcpUyS2YoR7xrdwqjywQ@mail.gmail.com' \
    --to=nphamcs@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bhe@redhat.com \
    --cc=chrisl@kernel.org \
    --cc=kasong@tencent.com \
    --cc=linux-mm@kvack.org \
    --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