Skip to contentSkip to conversation

mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 13, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: move folio_index to mm/swap.h and remove no longer needed helper
has been removed from the -mm tree. Its filename was
mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Kairui Song <[email protected]>
Subject: mm: move folio_index to mm/swap.h and remove no longer needed helper
Date: Thu, 1 May 2025 02:10:51 +0800

There are no remaining users of folio_index() outside the mm subsystem. Move it to mm/swap.h to co-locate it with swap_cache_index(), eliminating a forward declaration, and a function call overhead.

Also remove the helper that was used to fix circular header dependency issue.

Cc Chao Yu <[email protected]>
Cc Chris Li <[email protected]>
Cc Chris Mason <[email protected]>
Cc Christian Brauner <[email protected]>
Cc David Sterba <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jaegeuk Kim <[email protected]>
Cc Joanne Koong <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Josef Bacik <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Miklos Szeredi <[email protected]>
Cc Nhat Pham <[email protected]>
Cc Qu Wenruo <[email protected]>
Cc Yosry Ahmed <[email protected]>

---

 include/linux/pagemap.h |   20 --------------------
 mm/gup.c                |    1 +
 mm/memfd.c              |    1 +
 mm/migrate.c            |    1 +
 mm/page-writeback.c     |    1 +
 mm/swap.h               |   18 ++++++++++++++++++
 mm/swapfile.c           |    6 ------
 7 files changed, 22 insertions(+), 26 deletions(-)
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +0 -20
@@ -884,26 +884,6 @@ static inline struct page *grab_cache_pa
 			mapping_gfp_mask(mapping));
 }
 
-extern pgoff_t __folio_swap_cache_index(struct folio *folio);
-
-/**
- * folio_index - File index of a folio.
- * @folio: The folio.
- *
- * For a folio which is either in the page cache or the swap cache,
- * return its index within the address_space it belongs to.  If you know
- * the page is definitely in the page cache, you can look at the folio's
- * index directly.
- *
- * Return: The index (offset in units of pages) of a folio in its file.
- */
-static inline pgoff_t folio_index(struct folio *folio)
-{
-	if (unlikely(folio_test_swapcache(folio)))
-		return __folio_swap_cache_index(folio);
-	return folio->index;
-}
-
 /**
  * folio_next_index - Get the index of the next folio.
  * @folio: The current folio.
mm/gup.c renamed from mm/gup.c~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +1 -0
@@ -26,6 +26,7 @@
 #include <asm/tlbflush.h>
 
 #include "internal.h"
+#include "swap.h"
 
 struct follow_page_context {
 	struct dev_pagemap *pgmap;
mm/memfd.c renamed from mm/memfd.c~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +1 -0
@@ -20,6 +20,7 @@
 #include <linux/memfd.h>
 #include <linux/pid_namespace.h>
 #include <uapi/linux/memfd.h>
+#include "swap.h"
 
 /*
  * We need a tag: a new tag would expand every xa_node by 8 bytes,
mm/migrate.c renamed from mm/migrate.c~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +1 -0
@@ -50,6 +50,7 @@
 #include <trace/events/migrate.h>
 
 #include "internal.h"
+#include "swap.h"
 
 bool isolate_movable_page(struct page *page, isolate_mode_t mode)
 {
mm/page-writeback.c renamed from mm/page-writeback.c~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +1 -0
@@ -41,6 +41,7 @@
 #include <trace/events/writeback.h>
 
 #include "internal.h"
+#include "swap.h"
 
 /*
  * Sleep at most 200ms at a time in balance_dirty_pages().
mm/swapfile.c renamed from mm/swapfile.c~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +0 -6
@@ -3671,12 +3671,6 @@ struct address_space *swapcache_mapping(
 }
 EXPORT_SYMBOL_GPL(swapcache_mapping);
 
-pgoff_t __folio_swap_cache_index(struct folio *folio)
-{
-	return swap_cache_index(folio->swap);
-}
-EXPORT_SYMBOL_GPL(__folio_swap_cache_index);
-
 /*
  * add_swap_count_continuation - called when a swap count is duplicated
  * beyond SWAP_MAP_MAX, it allocates a new page and links that to the entry's
mm/swap.h renamed from mm/swap.h~mm-move-folio_index-to-mm-swaph-and-remove-no-longer-needed-helper +18 -0
@@ -201,4 +201,22 @@ static inline int swap_zeromap_batch(swp
 
 #endif /* CONFIG_SWAP */
 
+/**
+ * folio_index - File index of a folio.
+ * @folio: The folio.
+ *
+ * For a folio which is either in the page cache or the swap cache,
+ * return its index within the address_space it belongs to.  If you know
+ * the folio is definitely in the page cache, you can look at the folio's
+ * index directly.
+ *
+ * Return: The index (offset in units of pages) of a folio in its file.
+ */
+static inline pgoff_t folio_index(struct folio *folio)
+{
+	if (unlikely(folio_test_swapcache(folio)))
+		return swap_cache_index(folio->swap);
+	return folio->index;
+}
+
 #endif /* _MM_SWAP_H */

_

Patches currently in -mm which might be from [email protected] are