All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <baoquan.he@linux.dev>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, david@kernel.org, chrisl@kernel.org,
	kasong@tencent.com, urezki@gmail.com, hannes@cmpxchg.org,
	corbet@lwn.net, nphamcs@gmail.com, baohua@kernel.org,
	youngjun.park@lge.com, shikemeng@huaweicloud.com,
	yosry@kernel.org, chengming.zhou@linux.dev, kunwu.chan@gmail.com,
	klarasmodin@gmail.com, linux-kernel@vger.kernel.org,
	baoquan.he@linux.dev, Baoquan He <hebaoquan@kylinos.cn>
Subject: [PATCH v7 08/14] mm, swap: require zswap for xswap devices
Date: Sun, 29 Nov 2026 23:07:49 +0800	[thread overview]
Message-ID: <20261129150755.191662-9-baoquan.he@linux.dev> (raw)
In-Reply-To: <20261129150755.191662-1-baoquan.he@linux.dev>

From: Baoquan He <hebaoquan@kylinos.cn>

xswap pages live only in zswap.  Without zswap, swapout cannot
free the page, but still takes a swap entry.  So the device consumes
swap entries without freeing memory.  Fail to create a device when
zswap is unavailable.

Acked-by: Chris Li <chrisl@kernel.org>
Signed-off-by: Baoquan He <hebaoquan@kylinos.cn>
---
 mm/swapfile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 1f319e365b68..ba899e349e99 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -4089,6 +4089,10 @@ static int xswap_create(int prio)
 	unsigned int type;
 	int error;
 
+	/* xswap has no backing store, it relies on zswap. */
+	if (!zswap_is_enabled())
+		return -EOPNOTSUPP;
+
 	mutex_lock(&xswap_ctl_lock);
 
 	spin_lock(&swap_lock);
-- 
2.54.0


  parent reply	other threads:[~2026-11-29 15:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 15:07 [PATCH v7 00/14] mm, swap: extendable swap devices (xswap phase I) Baoquan He
2026-11-29 15:07 ` [PATCH v7 01/14] mm/vmalloc: support vmalloc-backed VM_SPARSE areas Baoquan He
2026-11-30 15:09   ` sashiko-bot
2026-11-29 15:07 ` [PATCH v7 02/14] mm: xswap support for zswap Baoquan He
2026-11-29 15:07 ` [PATCH v7 03/14] mm, swap: refactor free_swap_cluster_info to take swap_info_struct Baoquan He
2026-11-29 15:07 ` [PATCH v7 04/14] mm, swap: use a VM_SPARSE cluster array for xswap devices Baoquan He
2026-11-29 15:07 ` [PATCH v7 05/14] mm, swap: widen swap_info_struct max/pages to unsigned long Baoquan He
2026-11-29 15:07 ` [PATCH v7 06/14] mm, swap: create the xswap device from swapon(2) Baoquan He
2026-11-30 15:09   ` sashiko-bot
2026-11-29 15:07 ` [PATCH v7 07/14] mm, swap: refactor swapoff and add xswap_destroy Baoquan He
2026-11-29 15:07 ` Baoquan He [this message]
2026-11-29 15:07 ` [PATCH v7 09/14] mm, swap: let the command line set the xswap device size Baoquan He
2026-11-30 15:09   ` sashiko-bot
2026-11-29 15:07 ` [PATCH v7 10/14] mm, swap: add CONFIG_XSWAP_DEFAULT_MAX Baoquan He
2026-11-29 15:07 ` [PATCH v7 11/14] mm, swap: add xswap grow trigger on cluster allocation Baoquan He
2026-11-30 15:09   ` sashiko-bot
2026-11-29 15:07 ` [PATCH v7 12/14] mm, swap: add debugfs counters for xswap Baoquan He
2026-11-29 15:07 ` [PATCH v7 13/14] mm, swap: do not give an xswap slot to a cgroup that cannot zswap Baoquan He
2026-11-30 15:09   ` sashiko-bot
2026-11-29 15:07 ` [PATCH v7 14/14] mm, swap: skip the overcommit probe when removing xswap Baoquan He

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=20261129150755.191662-9-baoquan.he@linux.dev \
    --to=baoquan.he@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=chengming.zhou@linux.dev \
    --cc=chrisl@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=hebaoquan@kylinos.cn \
    --cc=kasong@tencent.com \
    --cc=klarasmodin@gmail.com \
    --cc=kunwu.chan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=shikemeng@huaweicloud.com \
    --cc=urezki@gmail.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 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.