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

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