From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.147.51.103 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796201317; b=dG6hzDSxXg1bU9Tzv0HwUEMqn4fn1EIbsChCqqMsiU7Yz7rSBXC1iA2FcMDDd6YWZiTQ ZzikEddGssKlCyKDyCedNTw0n9Nk8kH3wmaD+r1PAx3aPpOBouzUyOj29vwLxj+hJwsv0 yqRRi2BIZ48s6KYXl6uwyHidlZVOLIgzOIw7uj0na3Ok3+3eyXm0tb+2oTP8/zECq3cWe SpSnHEd6/f1tBWnKAgLKUZe6IVgEQOoJU7ClpRl0aXUbJN8Y0ZDerDNLWg6gDIPpvtJlI 8mx2DwCvMyFsF6KxCyrXa9ahzEeHl2eTH6LDPUs/CdShGWOOnoDJc+znMCiW9I6IeSA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796201317; h=DMARC-Filter:Received:X-Original-SENDERIP:X-Original-MAILFROM:From: To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=9crhTmTuBsLHCknSyHdUTm9llhiXuw1nW/CIFgsci54=; b=tsnDpJZNXAoI+P/okz+1LtdzKeum5U6dlnqKBPi4l+hdcfngI7yC1l8NlzqZBkFvl13l dJbcpUL9QyZU185PWC7OKlyaSRi3ZZDnoSUVA6T/swdjO64y+C/bEXWZzBC1IZdKhSMBn KBk8pWBrWkeRqH3BjW/rRde/ltBp2YfMAa3LDpye5ABz1z0i8AvaiIb77JaxBN8f+5cEx g7eUXXE0D9qNpim9xfA8TgifBhQdN40K/Z+/8kdzHqbbkLcgBpWcyOMGl1beBsZnwzND5 W9R3XwLA4gXznVJr8BFzb7W9y5e/BWRjfwaIey8m7pDYdZSmWMM8pstoeUKFBExVBRg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lge.com; spf=pass smtp.mailfrom=lge.com; arc=none smtp.remote-ip=156.147.51.103 Received: from lgeamrelo07.lge.com (lgeamrelo07.lge.com [156.147.51.103]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60688606A6A6 for ; Wed, 2 Dec 2026 08:48:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 60688606A6A6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lge.com Received: from unknown (HELO yjaykim-PowerEdge-T330.lge.net) (10.177.112.156) by 156.147.51.103 with ESMTP; 2 Dec 2026 17:48:28 +0900 X-Original-SENDERIP: 10.177.112.156 X-Original-MAILFROM: youngjun.park@lge.com From: Youngjun Park To: Andrew Morton , linux-mm@kvack.org Cc: Johannes Weiner , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Shakeel Butt , Yosry Ahmed , Lian , Youngjun Park , 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 Message-Id: <20261202084826.2131931-2-youngjun.park@lge.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261202084826.2131931-1-youngjun.park@lge.com> References: <20261202084826.2131931-1-youngjun.park@lge.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Youngjun Park --- 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