From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>
Cc: Christian Brauner <brauner@kernel.org>,
"Darrick J . Wong " <djwong@kernel.org>,
Jens Axboe <axboe@kernel.dk>, David Sterba <dsterba@suse.com>,
"Theodore Ts'o" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>,
Chao Yu <chao@kernel.org>, Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
Namjae Jeon <linkinjeon@kernel.org>,
Hyunchul Lee <hyc.lee@gmail.com>,
Steve French <sfrench@samba.org>,
Paulo Alcantara <pc@manguebit.org>,
Carlos Maiolino <cem@kernel.org>,
Damien Le Moal <dlemoal@kernel.org>,
Naohiro Aota <naohiro.aota@wdc.com>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-mm@kvack.org,
linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org
Subject: [PATCH 12/12] swap: move swap_info_struct to mm/swap.h
Date: Tue, 12 May 2026 07:35:28 +0200 [thread overview]
Message-ID: <20260512053625.2950900-13-hch@lst.de> (raw)
In-Reply-To: <20260512053625.2950900-1-hch@lst.de>
swap_info_struct is now internal to the MM subsystem, so remove it from
the public header.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/swap.h | 98 +-------------------------------------------
mm/swap.h | 92 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+), 96 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 95237ee065c2..31eef9b74949 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -16,9 +16,9 @@
#include <uapi/linux/mempolicy.h>
#include <asm/page.h>
-struct notifier_block;
-
struct bio;
+struct notifier_block;
+struct swap_info_struct;
#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
#define SWAP_FLAG_PRIO_MASK 0x7fff
@@ -178,29 +178,6 @@ struct sysinfo;
struct writeback_control;
struct zone;
-/*
- * Max bad pages in the new format..
- */
-#define MAX_SWAP_BADPAGES \
- ((offsetof(union swap_header, magic.magic) - \
- offsetof(union swap_header, info.badpages)) / sizeof(int))
-
-enum {
- SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
- SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
- SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
- SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
- SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
- SWP_BLKDEV = (1 << 6), /* its a block device */
- SWP_ACTIVATED = (1 << 7), /* set after swap_activate success */
- SWP_FS_OPS = (1 << 8), /* swapfile operations go through fs */
- SWP_AREA_DISCARD = (1 << 9), /* single-time swap area discards */
- SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */
- SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */
- SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */
- /* add others here before... */
-};
-
#define SWAP_CLUSTER_MAX 32UL
#define SWAP_CLUSTER_MAX_SKIPPED (SWAP_CLUSTER_MAX << 10)
#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
@@ -219,56 +196,6 @@ enum {
#define SWAP_NR_ORDERS 1
#endif
-/*
- * We keep using same cluster for rotational device so IO will be sequential.
- * The purpose is to optimize SWAP throughput on these device.
- */
-struct swap_sequential_cluster {
- unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */
-};
-
-/*
- * The in-memory structure used to track swap areas.
- */
-struct swap_info_struct {
- struct percpu_ref users; /* indicate and keep swap device valid. */
- unsigned long flags; /* SWP_USED etc: see above */
- signed short prio; /* swap priority of this type */
- struct plist_node list; /* entry in swap_active_head */
- signed char type; /* strange name for an index */
- unsigned int max; /* size of this swap device */
- unsigned long *zeromap; /* kvmalloc'ed bitmap to track zero pages */
- struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
- struct list_head free_clusters; /* free clusters list */
- struct list_head full_clusters; /* full clusters list */
- struct list_head nonfull_clusters[SWAP_NR_ORDERS];
- /* list of cluster that contains at least one free slot */
- struct list_head frag_clusters[SWAP_NR_ORDERS];
- /* list of cluster that are fragmented or contented */
- unsigned int pages; /* total of usable pages of swap */
- atomic_long_t inuse_pages; /* number of those currently in use */
- struct swap_sequential_cluster *global_cluster; /* Use one global cluster for rotating device */
- spinlock_t global_cluster_lock; /* Serialize usage of global cluster */
- struct rb_root swap_extent_root;/* root of the swap extent rbtree */
- struct block_device *bdev; /* swap device or bdev of swap file */
- struct file *swap_file; /* seldom referenced */
- struct completion comp; /* seldom referenced */
- spinlock_t lock; /*
- * protect map scan related fields like
- * inuse_pages and all cluster lists.
- * Other fields are only changed
- * at swapon/swapoff, so are protected
- * by swap_lock. changing flags need
- * hold this lock and swap_lock. If
- * both locks need hold, hold swap_lock
- * first.
- */
- struct work_struct discard_work; /* discard worker */
- struct work_struct reclaim_work; /* reclaim worker */
- struct list_head discard_clusters; /* discard clusters list */
- struct plist_node avail_list; /* entry in swap_avail_head */
-};
-
static inline swp_entry_t page_swap_entry(struct page *page)
{
struct folio *folio = page_folio(page);
@@ -423,10 +350,7 @@ int find_first_swap(dev_t *device);
extern unsigned int count_swap_pages(int, int);
extern sector_t swapdev_block(int, pgoff_t);
extern int __swap_count(swp_entry_t entry);
-extern bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry);
extern int swp_swapcount(swp_entry_t entry);
-struct backing_dev_info;
-extern struct swap_info_struct *get_swap_device(swp_entry_t entry);
sector_t swap_folio_sector(struct folio *folio);
/*
@@ -452,20 +376,7 @@ bool folio_free_swap(struct folio *folio);
swp_entry_t swap_alloc_hibernation_slot(int type);
void swap_free_hibernation_slot(swp_entry_t entry);
-static inline void put_swap_device(struct swap_info_struct *si)
-{
- percpu_ref_put(&si->users);
-}
-
#else /* CONFIG_SWAP */
-static inline struct swap_info_struct *get_swap_device(swp_entry_t entry)
-{
- return NULL;
-}
-
-static inline void put_swap_device(struct swap_info_struct *si)
-{
-}
#define get_nr_swap_pages() 0L
#define total_swap_pages 0L
@@ -497,11 +408,6 @@ static inline int __swap_count(swp_entry_t entry)
return 0;
}
-static inline bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry)
-{
- return false;
-}
-
static inline int swp_swapcount(swp_entry_t entry)
{
return 0;
diff --git a/mm/swap.h b/mm/swap.h
index a77016f2423b..70974495bf15 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -8,6 +8,79 @@ struct swap_iocb;
extern int page_cluster;
+/*
+ * We keep using same cluster for rotational device so IO will be sequential.
+ * The purpose is to optimize SWAP throughput on these device.
+ */
+struct swap_sequential_cluster {
+ unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */
+};
+
+/*
+ * The in-memory structure used to track swap areas.
+ */
+struct swap_info_struct {
+ struct percpu_ref users; /* indicate and keep swap device valid. */
+ unsigned long flags; /* SWP_USED etc: see above */
+ signed short prio; /* swap priority of this type */
+ struct plist_node list; /* entry in swap_active_head */
+ signed char type; /* strange name for an index */
+ unsigned int max; /* size of this swap device */
+ unsigned long *zeromap; /* kvmalloc'ed bitmap to track zero pages */
+ struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
+ struct list_head free_clusters; /* free clusters list */
+ struct list_head full_clusters; /* full clusters list */
+ struct list_head nonfull_clusters[SWAP_NR_ORDERS];
+ /* list of cluster that contains at least one free slot */
+ struct list_head frag_clusters[SWAP_NR_ORDERS];
+ /* list of cluster that are fragmented or contented */
+ unsigned int pages; /* total of usable pages of swap */
+ atomic_long_t inuse_pages; /* number of those currently in use */
+ struct swap_sequential_cluster *global_cluster; /* Use one global cluster for rotating device */
+ spinlock_t global_cluster_lock; /* Serialize usage of global cluster */
+ struct rb_root swap_extent_root;/* root of the swap extent rbtree */
+ struct block_device *bdev; /* swap device or bdev of swap file */
+ struct file *swap_file; /* seldom referenced */
+ struct completion comp; /* seldom referenced */
+ spinlock_t lock; /*
+ * protect map scan related fields like
+ * inuse_pages and all cluster lists.
+ * Other fields are only changed
+ * at swapon/swapoff, so are protected
+ * by swap_lock. changing flags need
+ * hold this lock and swap_lock. If
+ * both locks need hold, hold swap_lock
+ * first.
+ */
+ struct work_struct discard_work; /* discard worker */
+ struct work_struct reclaim_work; /* reclaim worker */
+ struct list_head discard_clusters; /* discard clusters list */
+ struct plist_node avail_list; /* entry in swap_avail_head */
+};
+
+/*
+ * Max bad pages in the new format..
+ */
+#define MAX_SWAP_BADPAGES \
+ ((offsetof(union swap_header, magic.magic) - \
+ offsetof(union swap_header, info.badpages)) / sizeof(int))
+
+enum {
+ SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
+ SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
+ SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
+ SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
+ SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
+ SWP_BLKDEV = (1 << 6), /* its a block device */
+ SWP_ACTIVATED = (1 << 7), /* set after swap_activate success */
+ SWP_FS_OPS = (1 << 8), /* swapfile operations go through fs */
+ SWP_AREA_DISCARD = (1 << 9), /* single-time swap area discards */
+ SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */
+ SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */
+ SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */
+ /* add others here before... */
+};
+
#ifdef CONFIG_THP_SWAP
#define SWAPFILE_CLUSTER HPAGE_PMD_NR
#define swap_entry_order(order) (order)
@@ -352,6 +425,13 @@ static inline int non_swapcache_batch(swp_entry_t entry, int max_nr)
return i;
}
+bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry);
+struct swap_info_struct *get_swap_device(swp_entry_t entry);
+static inline void put_swap_device(struct swap_info_struct *si)
+{
+ percpu_ref_put(&si->users);
+}
+
#else /* CONFIG_SWAP */
struct swap_iocb;
static inline struct swap_cluster_info *swap_cluster_lock(
@@ -498,5 +578,17 @@ static inline int non_swapcache_batch(swp_entry_t entry, int max_nr)
{
return 0;
}
+static inline bool swap_entry_swapped(struct swap_info_struct *si,
+ swp_entry_t entry)
+{
+ return false;
+}
+static inline struct swap_info_struct *get_swap_device(swp_entry_t entry)
+{
+ return NULL;
+}
+static inline void put_swap_device(struct swap_info_struct *si)
+{
+}
#endif /* CONFIG_SWAP */
#endif /* _MM_SWAP_H */
--
2.53.0
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>
Cc: Paulo Alcantara <pc@manguebit.org>,
linux-doc@vger.kernel.org,
"Darrick J . Wong " <djwong@kernel.org>,
Carlos Maiolino <cem@kernel.org>,
Hyunchul Lee <hyc.lee@gmail.com>,
linux-mm@kvack.org, Naohiro Aota <naohiro.aota@wdc.com>,
linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org,
Namjae Jeon <linkinjeon@kernel.org>,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-block@vger.kernel.org, Damien Le Moal <dlemoal@kernel.org>,
David Sterba <dsterba@suse.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
Jens Axboe <axboe@kernel.dk>,
Christian Brauner <brauner@kernel.org>,
Theodore Ts'o <tytso@mit.edu>,
linux-f2fs-devel@lists.sourceforge.net,
Steve French <sfrench@samba.org>,
Trond Myklebust <trondmy@kernel.org>,
Anna Schumaker <anna@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH 12/12] swap: move swap_info_struct to mm/swap.h
Date: Tue, 12 May 2026 07:35:28 +0200 [thread overview]
Message-ID: <20260512053625.2950900-13-hch@lst.de> (raw)
In-Reply-To: <20260512053625.2950900-1-hch@lst.de>
swap_info_struct is now internal to the MM subsystem, so remove it from
the public header.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
include/linux/swap.h | 98 +-------------------------------------------
mm/swap.h | 92 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+), 96 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 95237ee065c2..31eef9b74949 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -16,9 +16,9 @@
#include <uapi/linux/mempolicy.h>
#include <asm/page.h>
-struct notifier_block;
-
struct bio;
+struct notifier_block;
+struct swap_info_struct;
#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
#define SWAP_FLAG_PRIO_MASK 0x7fff
@@ -178,29 +178,6 @@ struct sysinfo;
struct writeback_control;
struct zone;
-/*
- * Max bad pages in the new format..
- */
-#define MAX_SWAP_BADPAGES \
- ((offsetof(union swap_header, magic.magic) - \
- offsetof(union swap_header, info.badpages)) / sizeof(int))
-
-enum {
- SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
- SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
- SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
- SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
- SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
- SWP_BLKDEV = (1 << 6), /* its a block device */
- SWP_ACTIVATED = (1 << 7), /* set after swap_activate success */
- SWP_FS_OPS = (1 << 8), /* swapfile operations go through fs */
- SWP_AREA_DISCARD = (1 << 9), /* single-time swap area discards */
- SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */
- SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */
- SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */
- /* add others here before... */
-};
-
#define SWAP_CLUSTER_MAX 32UL
#define SWAP_CLUSTER_MAX_SKIPPED (SWAP_CLUSTER_MAX << 10)
#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
@@ -219,56 +196,6 @@ enum {
#define SWAP_NR_ORDERS 1
#endif
-/*
- * We keep using same cluster for rotational device so IO will be sequential.
- * The purpose is to optimize SWAP throughput on these device.
- */
-struct swap_sequential_cluster {
- unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */
-};
-
-/*
- * The in-memory structure used to track swap areas.
- */
-struct swap_info_struct {
- struct percpu_ref users; /* indicate and keep swap device valid. */
- unsigned long flags; /* SWP_USED etc: see above */
- signed short prio; /* swap priority of this type */
- struct plist_node list; /* entry in swap_active_head */
- signed char type; /* strange name for an index */
- unsigned int max; /* size of this swap device */
- unsigned long *zeromap; /* kvmalloc'ed bitmap to track zero pages */
- struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
- struct list_head free_clusters; /* free clusters list */
- struct list_head full_clusters; /* full clusters list */
- struct list_head nonfull_clusters[SWAP_NR_ORDERS];
- /* list of cluster that contains at least one free slot */
- struct list_head frag_clusters[SWAP_NR_ORDERS];
- /* list of cluster that are fragmented or contented */
- unsigned int pages; /* total of usable pages of swap */
- atomic_long_t inuse_pages; /* number of those currently in use */
- struct swap_sequential_cluster *global_cluster; /* Use one global cluster for rotating device */
- spinlock_t global_cluster_lock; /* Serialize usage of global cluster */
- struct rb_root swap_extent_root;/* root of the swap extent rbtree */
- struct block_device *bdev; /* swap device or bdev of swap file */
- struct file *swap_file; /* seldom referenced */
- struct completion comp; /* seldom referenced */
- spinlock_t lock; /*
- * protect map scan related fields like
- * inuse_pages and all cluster lists.
- * Other fields are only changed
- * at swapon/swapoff, so are protected
- * by swap_lock. changing flags need
- * hold this lock and swap_lock. If
- * both locks need hold, hold swap_lock
- * first.
- */
- struct work_struct discard_work; /* discard worker */
- struct work_struct reclaim_work; /* reclaim worker */
- struct list_head discard_clusters; /* discard clusters list */
- struct plist_node avail_list; /* entry in swap_avail_head */
-};
-
static inline swp_entry_t page_swap_entry(struct page *page)
{
struct folio *folio = page_folio(page);
@@ -423,10 +350,7 @@ int find_first_swap(dev_t *device);
extern unsigned int count_swap_pages(int, int);
extern sector_t swapdev_block(int, pgoff_t);
extern int __swap_count(swp_entry_t entry);
-extern bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry);
extern int swp_swapcount(swp_entry_t entry);
-struct backing_dev_info;
-extern struct swap_info_struct *get_swap_device(swp_entry_t entry);
sector_t swap_folio_sector(struct folio *folio);
/*
@@ -452,20 +376,7 @@ bool folio_free_swap(struct folio *folio);
swp_entry_t swap_alloc_hibernation_slot(int type);
void swap_free_hibernation_slot(swp_entry_t entry);
-static inline void put_swap_device(struct swap_info_struct *si)
-{
- percpu_ref_put(&si->users);
-}
-
#else /* CONFIG_SWAP */
-static inline struct swap_info_struct *get_swap_device(swp_entry_t entry)
-{
- return NULL;
-}
-
-static inline void put_swap_device(struct swap_info_struct *si)
-{
-}
#define get_nr_swap_pages() 0L
#define total_swap_pages 0L
@@ -497,11 +408,6 @@ static inline int __swap_count(swp_entry_t entry)
return 0;
}
-static inline bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry)
-{
- return false;
-}
-
static inline int swp_swapcount(swp_entry_t entry)
{
return 0;
diff --git a/mm/swap.h b/mm/swap.h
index a77016f2423b..70974495bf15 100644
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -8,6 +8,79 @@ struct swap_iocb;
extern int page_cluster;
+/*
+ * We keep using same cluster for rotational device so IO will be sequential.
+ * The purpose is to optimize SWAP throughput on these device.
+ */
+struct swap_sequential_cluster {
+ unsigned int next[SWAP_NR_ORDERS]; /* Likely next allocation offset */
+};
+
+/*
+ * The in-memory structure used to track swap areas.
+ */
+struct swap_info_struct {
+ struct percpu_ref users; /* indicate and keep swap device valid. */
+ unsigned long flags; /* SWP_USED etc: see above */
+ signed short prio; /* swap priority of this type */
+ struct plist_node list; /* entry in swap_active_head */
+ signed char type; /* strange name for an index */
+ unsigned int max; /* size of this swap device */
+ unsigned long *zeromap; /* kvmalloc'ed bitmap to track zero pages */
+ struct swap_cluster_info *cluster_info; /* cluster info. Only for SSD */
+ struct list_head free_clusters; /* free clusters list */
+ struct list_head full_clusters; /* full clusters list */
+ struct list_head nonfull_clusters[SWAP_NR_ORDERS];
+ /* list of cluster that contains at least one free slot */
+ struct list_head frag_clusters[SWAP_NR_ORDERS];
+ /* list of cluster that are fragmented or contented */
+ unsigned int pages; /* total of usable pages of swap */
+ atomic_long_t inuse_pages; /* number of those currently in use */
+ struct swap_sequential_cluster *global_cluster; /* Use one global cluster for rotating device */
+ spinlock_t global_cluster_lock; /* Serialize usage of global cluster */
+ struct rb_root swap_extent_root;/* root of the swap extent rbtree */
+ struct block_device *bdev; /* swap device or bdev of swap file */
+ struct file *swap_file; /* seldom referenced */
+ struct completion comp; /* seldom referenced */
+ spinlock_t lock; /*
+ * protect map scan related fields like
+ * inuse_pages and all cluster lists.
+ * Other fields are only changed
+ * at swapon/swapoff, so are protected
+ * by swap_lock. changing flags need
+ * hold this lock and swap_lock. If
+ * both locks need hold, hold swap_lock
+ * first.
+ */
+ struct work_struct discard_work; /* discard worker */
+ struct work_struct reclaim_work; /* reclaim worker */
+ struct list_head discard_clusters; /* discard clusters list */
+ struct plist_node avail_list; /* entry in swap_avail_head */
+};
+
+/*
+ * Max bad pages in the new format..
+ */
+#define MAX_SWAP_BADPAGES \
+ ((offsetof(union swap_header, magic.magic) - \
+ offsetof(union swap_header, info.badpages)) / sizeof(int))
+
+enum {
+ SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
+ SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
+ SWP_DISCARDABLE = (1 << 2), /* blkdev support discard */
+ SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
+ SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
+ SWP_BLKDEV = (1 << 6), /* its a block device */
+ SWP_ACTIVATED = (1 << 7), /* set after swap_activate success */
+ SWP_FS_OPS = (1 << 8), /* swapfile operations go through fs */
+ SWP_AREA_DISCARD = (1 << 9), /* single-time swap area discards */
+ SWP_PAGE_DISCARD = (1 << 10), /* freed swap page-cluster discards */
+ SWP_STABLE_WRITES = (1 << 11), /* no overwrite PG_writeback pages */
+ SWP_SYNCHRONOUS_IO = (1 << 12), /* synchronous IO is efficient */
+ /* add others here before... */
+};
+
#ifdef CONFIG_THP_SWAP
#define SWAPFILE_CLUSTER HPAGE_PMD_NR
#define swap_entry_order(order) (order)
@@ -352,6 +425,13 @@ static inline int non_swapcache_batch(swp_entry_t entry, int max_nr)
return i;
}
+bool swap_entry_swapped(struct swap_info_struct *si, swp_entry_t entry);
+struct swap_info_struct *get_swap_device(swp_entry_t entry);
+static inline void put_swap_device(struct swap_info_struct *si)
+{
+ percpu_ref_put(&si->users);
+}
+
#else /* CONFIG_SWAP */
struct swap_iocb;
static inline struct swap_cluster_info *swap_cluster_lock(
@@ -498,5 +578,17 @@ static inline int non_swapcache_batch(swp_entry_t entry, int max_nr)
{
return 0;
}
+static inline bool swap_entry_swapped(struct swap_info_struct *si,
+ swp_entry_t entry)
+{
+ return false;
+}
+static inline struct swap_info_struct *get_swap_device(swp_entry_t entry)
+{
+ return NULL;
+}
+static inline void put_swap_device(struct swap_info_struct *si)
+{
+}
#endif /* CONFIG_SWAP */
#endif /* _MM_SWAP_H */
--
2.53.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-05-12 5:38 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 5:35 improve the swap_activate interface Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 5:35 ` [PATCH 01/12] swap: remove the maxpages variable in sys_swapon Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:08 ` Damien Le Moal
2026-05-12 7:08 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 7:20 ` Christoph Hellwig
2026-05-12 7:20 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 14:19 ` Hannes Reinecke
2026-05-12 14:19 ` [f2fs-dev] " Hannes Reinecke
2026-05-12 16:14 ` Darrick J. Wong
2026-05-12 16:14 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:37 ` Chris Li
2026-05-15 22:37 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 02/12] swap: move boilerplate code into the core swap code Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:11 ` Damien Le Moal
2026-05-12 7:11 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 16:33 ` Darrick J. Wong
2026-05-12 16:33 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:29 ` Chris Li
2026-05-15 22:29 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 03/12] swap,fs: move swapfile operations to struct file_operations Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] [PATCH 03/12] swap, fs: " Christoph Hellwig
2026-05-12 7:16 ` [PATCH 03/12] swap,fs: " Damien Le Moal
2026-05-12 7:16 ` [f2fs-dev] [PATCH 03/12] swap, fs: " Damien Le Moal via Linux-f2fs-devel
2026-05-12 16:41 ` [PATCH 03/12] swap,fs: " Darrick J. Wong
2026-05-12 16:41 ` [f2fs-dev] [PATCH 03/12] swap, fs: " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:24 ` [PATCH 03/12] swap,fs: " Chris Li
2026-05-15 22:24 ` [f2fs-dev] [PATCH 03/12] swap, fs: " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 04/12] swap: restrict to regular files or block devices Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:17 ` Damien Le Moal
2026-05-12 7:17 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 16:42 ` Darrick J. Wong
2026-05-12 16:42 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:19 ` Chris Li
2026-05-15 22:19 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 05/12] swap: cleanup setup_swap_extents Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:18 ` Damien Le Moal
2026-05-12 7:18 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 16:43 ` Darrick J. Wong
2026-05-12 16:43 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-13 5:56 ` Christoph Hellwig
2026-05-13 5:56 ` [f2fs-dev] " Christoph Hellwig
2026-05-15 22:18 ` Chris Li
2026-05-15 22:18 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 06/12] swap,block: move the block device swapon code into block/fops.c Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] [PATCH 06/12] swap, block: " Christoph Hellwig
2026-05-12 7:20 ` [PATCH 06/12] swap,block: " Damien Le Moal
2026-05-12 7:20 ` [f2fs-dev] [PATCH 06/12] swap, block: " Damien Le Moal via Linux-f2fs-devel
2026-05-12 16:44 ` [PATCH 06/12] swap,block: " Darrick J. Wong
2026-05-12 16:44 ` [f2fs-dev] [PATCH 06/12] swap, block: " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:14 ` [PATCH 06/12] swap,block: " Chris Li
2026-05-15 22:14 ` [f2fs-dev] [PATCH 06/12] swap, block: " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 07/12] swap,block: limit swap file size to device size Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] [PATCH 07/12] swap, block: " Christoph Hellwig
2026-05-12 7:21 ` [PATCH 07/12] swap,block: " Damien Le Moal
2026-05-12 7:21 ` [f2fs-dev] [PATCH 07/12] swap, block: " Damien Le Moal via Linux-f2fs-devel
2026-05-12 7:23 ` [PATCH 07/12] swap,block: " Christoph Hellwig
2026-05-12 7:23 ` [f2fs-dev] [PATCH 07/12] swap, block: " Christoph Hellwig
2026-05-12 16:45 ` [PATCH 07/12] swap,block: " Darrick J. Wong
2026-05-12 16:45 ` [f2fs-dev] [PATCH 07/12] swap, block: " Darrick J. Wong via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 08/12] swap,iomap: simplify iomap_swapfile_iter Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:31 ` Damien Le Moal
2026-05-12 7:31 ` [f2fs-dev] [PATCH 08/12] swap, iomap: " Damien Le Moal via Linux-f2fs-devel
2026-05-12 17:02 ` [PATCH 08/12] swap,iomap: " Darrick J. Wong
2026-05-12 17:02 ` [f2fs-dev] [PATCH 08/12] swap, iomap: " Darrick J. Wong via Linux-f2fs-devel
2026-05-13 6:56 ` [PATCH 08/12] swap,iomap: " Christoph Hellwig
2026-05-13 6:56 ` [f2fs-dev] [PATCH 08/12] swap, iomap: " Christoph Hellwig
2026-05-13 14:59 ` [PATCH 08/12] swap,iomap: " Darrick J. Wong
2026-05-13 14:59 ` [f2fs-dev] [PATCH 08/12] swap, iomap: " Darrick J. Wong via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 09/12] swap: push down setting sis->bdev into ->swap_activate Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:34 ` Damien Le Moal
2026-05-12 7:34 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 17:08 ` Darrick J. Wong
2026-05-12 17:08 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-13 5:58 ` Christoph Hellwig
2026-05-13 5:58 ` [f2fs-dev] " Christoph Hellwig
2026-05-13 7:44 ` Damien Le Moal
2026-05-13 7:44 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-13 7:46 ` Christoph Hellwig
2026-05-13 7:46 ` [f2fs-dev] " Christoph Hellwig
2026-05-13 7:58 ` Damien Le Moal
2026-05-13 7:58 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-14 14:37 ` Darrick J. Wong
2026-05-14 14:37 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:12 ` Chris Li
2026-05-15 22:12 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 10/12] swap: add a swap_activate_fs_ops helper Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:36 ` Damien Le Moal
2026-05-12 7:36 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 17:09 ` Darrick J. Wong
2026-05-12 17:09 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 22:00 ` Chris Li
2026-05-15 22:00 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` [PATCH 11/12] swap: move struct swap_extent to swapfile.c Christoph Hellwig
2026-05-12 5:35 ` [f2fs-dev] " Christoph Hellwig
2026-05-12 7:36 ` Damien Le Moal
2026-05-12 7:36 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 17:09 ` Darrick J. Wong
2026-05-12 17:09 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 21:58 ` Chris Li
2026-05-15 21:58 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-12 5:35 ` Christoph Hellwig [this message]
2026-05-12 5:35 ` [f2fs-dev] [PATCH 12/12] swap: move swap_info_struct to mm/swap.h Christoph Hellwig
2026-05-12 7:41 ` Damien Le Moal
2026-05-12 7:41 ` [f2fs-dev] " Damien Le Moal via Linux-f2fs-devel
2026-05-12 17:10 ` Darrick J. Wong
2026-05-12 17:10 ` [f2fs-dev] " Darrick J. Wong via Linux-f2fs-devel
2026-05-15 21:58 ` Chris Li
2026-05-15 21:58 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
2026-05-13 20:34 ` improve the swap_activate interface Steve French
2026-05-13 20:34 ` [f2fs-dev] " Steve French
2026-05-15 11:33 ` Christoph Hellwig
2026-05-15 11:33 ` [f2fs-dev] " Christoph Hellwig
2026-05-15 21:40 ` Chris Li
2026-05-15 21:40 ` [f2fs-dev] " Chris Li via Linux-f2fs-devel
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=20260512053625.2950900-13-hch@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=anna@kernel.org \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=chao@kernel.org \
--cc=chrisl@kernel.org \
--cc=djwong@kernel.org \
--cc=dlemoal@kernel.org \
--cc=dsterba@suse.com \
--cc=hyc.lee@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=kasong@tencent.com \
--cc=linkinjeon@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=naohiro.aota@wdc.com \
--cc=pc@manguebit.org \
--cc=sfrench@samba.org \
--cc=trondmy@kernel.org \
--cc=tytso@mit.edu \
/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.