Blame SOURCES/0006-memory-Handle-struct-slab-changes-on-Linux-5.17-rc1-.patch

e039e7
From a392b27653e4e75460753522af0f006006b4dc4e Mon Sep 17 00:00:00 2001
e039e7
From: Alexander Egorenkov <egorenar@linux.ibm.com>
e039e7
Date: Mon, 6 Dec 2021 16:04:19 +0100
e039e7
Subject: [PATCH 06/11] memory: Handle struct slab changes on Linux 5.17-rc1
e039e7
 and later
e039e7
e039e7
Since kernel commit d122019bf061 ("mm: Split slab into its own type"),
e039e7
the struct slab is used for both SLAB and SLUB. Therefore, don't depend
e039e7
on the non-presence of the struct slab to decide whether SLAB implementation
e039e7
should be chosen and use the member variable "cpu_slab" of the struct
e039e7
kmem_cache instead, it should be present only in SLUB.
e039e7
e039e7
Without the patch, crash fails to start with the error message:
e039e7
e039e7
  crash: invalid structure member offset: kmem_cache_s_num
e039e7
             FILE: memory.c  LINE: 9619  FUNCTION: kmem_cache_init()
e039e7
e039e7
Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
e039e7
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
e039e7
---
e039e7
 memory.c | 3 ++-
e039e7
 1 file changed, 2 insertions(+), 1 deletion(-)
e039e7
e039e7
diff --git a/memory.c b/memory.c
e039e7
index 86c02c132890..5af45fd7d834 100644
e039e7
--- a/memory.c
e039e7
+++ b/memory.c
e039e7
@@ -576,7 +576,8 @@ vm_init(void)
e039e7
 		STRUCT_SIZE_INIT(cpucache_s, "cpucache_s");
e039e7
 
e039e7
         } else if (!VALID_STRUCT(kmem_slab_s) && 
e039e7
-		   !VALID_STRUCT(slab_s) && 
e039e7
+		   !VALID_STRUCT(slab_s) &&
e039e7
+		   !MEMBER_EXISTS("kmem_cache", "cpu_slab") &&
e039e7
 		   (VALID_STRUCT(slab) || (vt->flags & SLAB_OVERLOAD_PAGE))) {
e039e7
                 vt->flags |= PERCPU_KMALLOC_V2;
e039e7
 
e039e7
-- 
e039e7
2.20.1
e039e7