Skip to contentSkip to conversation

linux-next: build failure after merge of the rcu tree

PATCH Stephen Rothwell 2 participants 5 messages Dec 4, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the rcu tree, today's linux-next build (sparc defconfig) failed like this:

mm/slab_common.o: In function `kmem_last_alloc':
slab_common.c:(.text+0xc4): undefined reference to `kmem_cache_last_alloc'

Caused by commit

f7c3fb4fc476 ("mm: Add kmem_last_alloc() to return last allocation for memory block")

in mm/slab.c, kmem_cache_last_alloc() is only defined when CONFIG_NUMA is set - which is not for this build.

I applied the following hack fix patch for today.

From ac5dcf78be1e6da530302966369a3bd63007cf81 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email protected]>
Date: Fri, 4 Dec 2020 19:11:01 +1100
Subject: [PATCH] fixup for "mm: Add kmem_last_alloc() to return last
allocation for memory block"

---
 mm/slab.c | 5 +++++
 1 file changed, 5 insertions(+)
mm/slab.c +5 -0
index 1f3b263f81ee..064707ac9f54 100644
@@ -3650,6 +3650,11 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t flags,
 	return __do_kmalloc_node(size, flags, node, caller);
 }
 EXPORT_SYMBOL(__kmalloc_node_track_caller);
+#else
+void *kmem_cache_last_alloc(struct kmem_cache *cachep, void *object)
+{
+	return NULL;
+}
 #endif /* CONFIG_NUMA */
 
 /**
Signature · 5 lines
2.29.2

-- 
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 17 lines · Stephen Rothwell

Hi all,

After merging the rcu tree, today's linux-next build (sparc defconfig) failed like this:

mm/slab_common.o: In function `kmem_last_alloc':
slab_common.c:(.text+0xc4): undefined reference to `kmem_cache_last_alloc'

Caused by commit

f7c3fb4fc476 ("mm: Add kmem_last_alloc() to return last allocation for memory block")

in mm/slab.c, kmem_cache_last_alloc() is only defined when CONFIG_NUMA is set - which is not for this build.

I applied the following hack fix patch for today.

Quoted 7 lines

From ac5dcf78be1e6da530302966369a3bd63007cf81 Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <[email protected]>
Date: Fri, 4 Dec 2020 19:11:01 +1100
Subject: [PATCH] fixup for "mm: Add kmem_last_alloc() to return last
allocation for memory block"

Apologies for the hassle and thank you for the very helpful "hack fix patch". The kbuild test robot also found this, but I hadn't quite gotten it through my head that the only slab definition of the kmem_cache_last_alloc() was under CONFIG_NUMA.

Does the following patch fix things? (Sigh. It won't apply on the rcu/next that you used. Or even on this moment's dev branch. I will fold it in with attribution and update. But just to show you what my thought is.)

Thanx, Paul

------------------------------------------------------------------------

mm/slab.c +21 -21
index 87aa2c0..ae1a74c 100644
@@ -3602,27 +3602,6 @@ void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
 EXPORT_SYMBOL(kmem_cache_alloc_node_trace);
 #endif
 
-void *kmem_cache_last_alloc(struct kmem_cache *cachep, void *object, void **stackp, int nstackp)
-{
-#ifdef DEBUG
-	unsigned int objnr;
-	void *objp;
-	struct page *page;
-
-	if (!(cachep->flags & SLAB_STORE_USER))
-		return ERR_PTR(-KMEM_LA_NO_DEBUG);
-	objp = object - obj_offset(cachep);
-	page = virt_to_head_page(objp);
-	objnr = obj_to_index(cachep, page, objp);
-	objp = index_to_obj(cachep, page, objnr);
-	if (stackp && nstackp)
-		stackp[0] = NULL;
-	return *dbg_userword(cachep, objp);
-#else
-	return NULL;
-#endif
-}
-
 static __always_inline void *
 __do_kmalloc_node(size_t size, gfp_t flags, int node, unsigned long caller)
 {
@@ -3654,6 +3633,27 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t flags,
 EXPORT_SYMBOL(__kmalloc_node_track_caller);
 #endif /* CONFIG_NUMA */
 
+void *kmem_cache_last_alloc(struct kmem_cache *cachep, void *object, void **stackp, int nstackp)
+{
+#ifdef DEBUG
+	unsigned int objnr;
+	void *objp;
+	struct page *page;
+
+	if (!(cachep->flags & SLAB_STORE_USER))
+		return ERR_PTR(-KMEM_LA_NO_DEBUG);
+	objp = object - obj_offset(cachep);
+	page = virt_to_head_page(objp);
+	objnr = obj_to_index(cachep, page, objp);
+	objp = index_to_obj(cachep, page, objnr);
+	if (stackp && nstackp)
+		stackp[0] = NULL;
+	return *dbg_userword(cachep, objp);
+#else
+	return NULL;
+#endif
+}
+
 /**
  * __do_kmalloc - allocate memory
  * @size: how many bytes of memory are required.
#2 lore raw

Hi Paul,

Quoted 5 lines · On Fri, 4 Dec 2020 11:20:32 -0800 "Paul E. McKenney" <[email protected]> wrote:

Does the following patch fix things? (Sigh. It won't apply on the rcu/next that you used. Or even on this moment's dev branch. I will fold it in with attribution and update. But just to show you what my thought is.)

Sorry I didn't get the chance to test your patch, but it seems to make sense. I notice that you have added this to the rcu tree for today, so I guess we will see :-)

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 4 lines · Stephen Rothwell

Hi Paul,

Quoted 1 line · On Fri, 4 Dec 2020 11:20:32 -0800 "Paul E. McKenney" <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines

Does the following patch fix things? (Sigh. It won't apply on the rcu/next that you used. Or even on this moment's dev branch. I will fold it in with attribution and update. But just to show you what my thought is.)

Sorry I didn't get the chance to test your patch, but it seems to make sense. I notice that you have added this to the rcu tree for today, so I guess we will see :-)

Fair enough! ;-)

Thanx, Paul

#4 lore raw

Hi Paul,

Quoted 11 lines · On Sun, 6 Dec 2020 20:48:41 -0800 "Paul E. McKenney" <[email protected]> wrote:
Quoted 9 lines · Stephen Rothwell

Hi Paul,

Quoted 5 lines · On Fri, 4 Dec 2020 11:20:32 -0800 "Paul E. McKenney" <[email protected]> wrote:

Does the following patch fix things? (Sigh. It won't apply on the rcu/next that you used. Or even on this moment's dev branch. I will fold it in with attribution and update. But just to show you what my thought is.)

Quoted 5 lines
Quoted 3 lines

Sorry I didn't get the chance to test your patch, but it seems to make sense. I notice that you have added this to the rcu tree for today, so I guess we will see :-)

Fair enough! ;-)

And it built fine, thanks.

Signature · 2 lines
Cheers,
Stephen Rothwell