From: Baoquan He <baoquan.he@linux.dev>
To: Youngjun Park <youngjun.park@lge.com>
Cc: Baoquan He <hebaoquan@kylinos.cn>,
linux-mm@kvack.org, akpm@linux-foundation.org, chrisl@kernel.org,
kasong@tencent.com, nphamcs@gmail.com, baohua@kernel.org,
hannes@cmpxchg.org, yosry@kernel.org, shikemeng@huaweicloud.com,
chengming.zhou@linux.dev, david@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 00/16] xswap: extendable swap device backed by zswap
Date: Fri, 4 Sep 2026 11:33:59 +0800 [thread overview]
Message-ID: <apo8J72dWW0CoS82@fedora> (raw)
In-Reply-To: <apkjJo+g6ewvLy5+@yjaykim-PowerEdge-T330>
On 09/03/26 at 04:35pm, Youngjun Park wrote:
> On Thu, Aug 27, 2026 at 05:44:50PM +0800, Baoquan He wrote:
> > xswap is an extendable swap device with no backing storage. Swapped-out
> > pages live only in zswap, so the device wastes no disk space and its
> > size is independent of any physical device.
> >
> > xswap decouples PTE swap entries from physical backing storage. The
> > cluster_info array is backed by a sparse vmalloc (VM_SPARSE) area that is
> > grown and shrunk on demand:
> >
> > - Grow: when cluster allocation runs out of free clusters and the device
> > is below its ceiling, more physical pages are mapped into the VM_SPARSE
> > area and their clusters are added to the free list.
> >
> > - Shrink: when contiguous free clusters accumulate at the tail of the
> > mapped range (tracked in O(1) via nr_free_tail), they are unmapped and
> > the backing pages freed. Shrink is deferred to a workqueue to avoid
> > lock recursion.
> >
> > A per-device ceiling (nr_clusters) bounds growth and is adjustable at
> > runtime via debugfs.
> >
> > Interface:
> >
> > /sys/kernel/mm/xswap/create write "<percent> [<prio>]" to
> > create a device; percent is a
> > percent of RAM (0 for the default),
> > prio is an optional swap priority
> > (default DEF_SWAP_PRIO)
>
> As discussed before, until there's a per-memcg tier concept, is there
> a meaningful use case for having more than one xswap device? Would it
> make sense to limit it to a single device for now, and add support
> for multiple devices later once that structure exists?
Hi Youngjun,
Thanks for careful checking and your question.
Here, I am also confused why both you and Nhat oppose per-device xswap.
Actually, supporting per-device xswap was part of Chris's original plan
and was designed for the swap tier. From my perspective, it's also a
very natural thing because the current swap code natively supports
per-device, and swap tier needs to use it anyway, so I don't bother
to add code to restrict it to single device. More importantly, for
per-device xswap, you can use one if you want, or multiple if you want
too, it won't prevent anyone from using a single xswap instance.
>
> Also, if xswap accepts an explicit prio, xswap devices would need to
> stay grouped within the same tier. But a slow tier with a different
> priority range could end up sandwiched in between, or an xswap device
> could fall outside the priority range needed to belong to the same
> tier.
>
> Could prio just be fixed instead? Is there a reason it needs to be
> assignable per device?
A good question. I haven't thought of a good way for xswap prio. Fixed
prio, or a high prio region for xswap? Zram is ram swap device too, it
shares the same prio setting semantics as a normal one. Can we keep it
as is, to leave it to xswap user?
Thanks
Baoquan
prev parent reply other threads:[~2026-09-04 3:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 9:44 Baoquan He
2026-08-27 9:44 ` [PATCH 01/16] mm: zswap: return -ENOENT when the swap device is gone Baoquan He
2026-09-02 14:53 ` Nhat Pham
2026-09-03 7:54 ` Baoquan He
2026-08-27 9:44 ` [PATCH 02/16] mm: xswap support for zswap Baoquan He
2026-08-27 9:44 ` [PATCH 03/16] mm, swap: add CONFIG_XSWAP and xswap fields to swap_info_struct Baoquan He
2026-08-27 9:44 ` [PATCH 04/16] mm, swap: refactor free_swap_cluster_info to take swap_info_struct Baoquan He
2026-08-27 9:44 ` [PATCH 05/16] mm, swap: add xswap cluster grow via VM_SPARSE vmalloc Baoquan He
2026-08-27 9:44 ` [PATCH 06/16] mm, swap: add sysfs create interface for xswap Baoquan He
2026-08-27 9:44 ` [PATCH 07/16] mm, swap: add xswap grow trigger on cluster allocation Baoquan He
2026-09-02 14:15 ` Nhat Pham
2026-09-03 8:24 ` Baoquan He
2026-08-27 9:44 ` [PATCH 08/16] mm, swap: add xswap_try_shrink and shrink trigger on cluster free Baoquan He
2026-08-27 9:44 ` [PATCH 09/16] mm, swap: free backing pages in xswap_unmap_clusters Baoquan He
2026-08-27 9:45 ` [PATCH 10/16] mm, swap: add nr_free_tail for O(1) xswap shrink detection Baoquan He
2026-08-27 9:45 ` [PATCH 11/16] mm, swap: add adjustable runtime ceiling (nr_clusters) for xswap Baoquan He
2026-08-27 9:45 ` [PATCH 12/16] mm, swap: add debugfs knob for xswap per-device cluster limit Baoquan He
2026-08-27 9:45 ` [PATCH 13/16] mm, swap: defer xswap shrink to workqueue to avoid lock recursion Baoquan He
2026-09-02 14:50 ` Nhat Pham
2026-09-03 9:17 ` Baoquan He
2026-08-27 9:45 ` [PATCH 14/16] mm, swap: refactor swapoff + add xswap_destroy Baoquan He
2026-09-03 6:59 ` Youngjun Park
2026-09-04 5:33 ` Baoquan He
2026-08-27 9:45 ` [PATCH 15/16] mm, swap: require zswap for xswap devices Baoquan He
2026-09-03 6:52 ` Youngjun Park
2026-09-04 7:57 ` Baoquan He
2026-08-27 9:45 ` [PATCH 16/16] mm, swap: allow setting xswap device priority at creation Baoquan He
2026-08-27 13:59 ` [syzbot ci] Re: xswap: extendable swap device backed by zswap syzbot ci
2026-08-31 8:35 ` Baoquan He
2026-08-31 17:54 ` [PATCH 00/16] " Kairui Song
2026-09-01 11:03 ` Baoquan He
2026-09-02 14:10 ` Nhat Pham
2026-09-04 9:42 ` Baoquan He
2026-09-02 14:33 ` Nhat Pham
2026-09-03 7:35 ` Youngjun Park
2026-09-04 3:33 ` Baoquan He [this message]
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=apo8J72dWW0CoS82@fedora \
--to=baoquan.he@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chengming.zhou@linux.dev \
--cc=chrisl@kernel.org \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hebaoquan@kylinos.cn \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=yosry@kernel.org \
--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
all inboxes | Powered by JetHome®