Subject: linux-next: manual merge of the slab tree with the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 2 Jan 2024 15:34:38 +1100

Hi all,

Today's linux-next merge of the slab tree got a conflict in:

  mm/slab_common.c

between commits:

  01869cf7b4c6 ("slub: use folio APIs in free_large_kmalloc()")
  8017164cb101 ("slub: use a folio in __kmalloc_large_node")

from the mm tree and commits:

  b774d3e326d3 ("mm/slab: move kfree() from slab_common.c to slub.c")
  4862caa5cba0 ("mm/slab: move kmalloc() functions from slab_common.c to slub.c")

from the slab tree.

I fixed it up (I used the latter version of this file and applied the
following merge fix patch) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

From: Stephen Rothwell <[email-masked]>
Date: Tue, 2 Jan 2024 15:26:48 +1100
Subject: [PATCH] fix up for "mm/slab: move kfree() from slab_common.c to
 slub.c"

and "mm/slab: move kmalloc() functions from slab_common.c to slub.c"
interacting with commits

  01869cf7b4c6 ("slub: use folio APIs in free_large_kmalloc()")
  8017164cb101 ("slub: use a folio in __kmalloc_large_node")

from the mm tree

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 mm/slub.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 236e728e49ed..2ef88bbf56a3 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3915,7 +3915,7 @@ EXPORT_SYMBOL(kmem_cache_alloc_node);
  */
 static void *__kmalloc_large_node(size_t size, gfp_t flags, int node)
 {
-	struct page *page;
+	struct folio *folio;
 	void *ptr = NULL;
 	unsigned int order = get_order(size);
 
@@ -3923,10 +3923,10 @@ static void *__kmalloc_large_node(size_t size, gfp_t flags, int node)
 		flags = kmalloc_fix_flags(flags);
 
 	flags |= __GFP_COMP;
-	page = alloc_pages_node(node, flags, order);
-	if (page) {
-		ptr = page_address(page);
-		mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B,
+	folio = (struct folio *)alloc_pages_node(node, flags, order);
+	if (folio) {
+		ptr = folio_address(folio);
+		lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B,
 				      PAGE_SIZE << order);
 	}
 
@@ -4375,9 +4375,9 @@ static void free_large_kmalloc(struct folio *folio, void *object)
 	kasan_kfree_large(object);
 	kmsan_kfree_large(object);
 
-	mod_lruvec_page_state(folio_page(folio, 0), NR_SLAB_UNRECLAIMABLE_B,
+	lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B,
 			      -(PAGE_SIZE << order));
-	__free_pages(folio_page(folio, 0), order);
+	folio_put(folio);
 }
 
 /**
-- 
2.43.0

-- 
Cheers,
Stephen Rothwell