From: Youngjun Park <youngjun.park@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
Kemeng Shi <shikemeng@huaweicloud.com>,
Nhat Pham <nphamcs@gmail.com>, Baoquan He <baoquan.he@linux.dev>,
Barry Song <baohua@kernel.org>,
Shakeel Butt <shakeel.butt@linux.dev>,
Yosry Ahmed <yosry.ahmed@linux.dev>, Lian <lianux.mm@gmail.com>,
Youngjun Park <youngjun.park@lge.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v12 1/3] mm: swap: introduce the swap tier as a swap priority
Date: Wed, 2 Dec 2026 17:48:24 +0900 [thread overview]
Message-ID: <20261202084826.2131931-2-youngjun.park@lge.com> (raw)
In-Reply-To: <20261202084826.2131931-1-youngjun.park@lge.com>
Per-cgroup swap device selection needs a notion of swap tier. Devices of
one priority are used round-robin and different priorities are strictly
ordered, so a priority already works as a tier. Add swap_tier() and
SWAP_TIER_MAX (no limit) to say so in code, instead of adding a separate
tier structure.
No functional change.
Suggested-by: Chris Li <chrisl@kernel.org>
Signed-off-by: Youngjun Park <youngjun.park@lge.com>
---
mm/swapfile.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d59fa8220862..95928d9f85da 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -1427,6 +1427,18 @@ static bool get_swap_device_info(struct swap_info_struct *si)
return true;
}
+/*
+ * A swap tier is a swap priority: devices of the same priority are used
+ * round-robin and different priorities are strictly ordered.
+ * SWAP_TIER_MAX means no tier limit.
+ */
+#define SWAP_TIER_MAX SHRT_MAX
+
+static inline short swap_tier(struct swap_info_struct *si)
+{
+ return si->prio;
+}
+
/*
* Fast path try to get swap entries with specified order from current
* CPU's swap entry pool (a cluster).
--
2.34.1
next prev parent reply other threads:[~2026-12-02 8:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:48 [PATCH v12 0/3] mm/swap: swap tier phase 1: priority as tier, per-cgroup via debugfs Youngjun Park
2026-12-02 8:48 ` Youngjun Park [this message]
2026-12-02 8:48 ` [PATCH v12 2/3] mm: swap: skip swap tiers above the memcg max tier Youngjun Park
2026-12-02 8:48 ` [PATCH v12 3/3] mm: swap: add debugfs to set memcg max swap tier Youngjun Park
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=20261202084826.2131931-2-youngjun.park@lge.com \
--to=youngjun.park@lge.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kasong@tencent.com \
--cc=lianux.mm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=yosry.ahmed@linux.dev \
/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®