Re: [PATCH 1/2] SLAB: Fix for "kmem -s|-S" options on Linux 6.1 and later

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 6, 2023 at 7:58 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@xxxxxxx> wrote:
Kernel commit e36ce448a08d ("mm/slab: use kmalloc_node() for off slab
freelist_idx_t array allocation"), which is contained in Linux 6.1 and
later kernels, removed kmem_cache.freelist_cache member.

Without the patch, crash does not set SLAB_OVERLOAD_PAGE and
"kmem -s|-S" options fail with the following error:

  kmem: invalid structure member offset: slab_list
        FILE: memory.c  LINE: 12156  FUNCTION: verify_slab_v2()

Use kmem_cache.freelist_size instead, which was instroduced together
with kmem_cache.freelist_cache by kernel commit 8456a648cf44.

These two patches look good to me. For them:

[1] [PATCH 1/2] SLAB: Fix for "kmem -s|-S" options on Linux 6.1 and later
[2] [PATCH 2/2] SLAB: Fix for "kmem -s|-S" options on Linux 6.2-rc1 and later

Ack. 

Thanks.
Lianbo


Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 memory.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index 625a94b7d7d4..71ded688206f 100644
--- a/memory.c
+++ b/memory.c
@@ -535,8 +535,11 @@ vm_init(void)
        /*
         * slab: overload struct slab over struct page
          * https://lkml.org/lkml/2013/10/16/155
+        *
+        * commit e36ce448a08d removed kmem_cache.freelist_cache in 6.1,
+        * so use freelist_size instead.
         */
-       if (MEMBER_EXISTS("kmem_cache", "freelist_cache")) {
+       if (MEMBER_EXISTS("kmem_cache", "freelist_size")) {
                vt->flags |= SLAB_OVERLOAD_PAGE;
                ANON_MEMBER_OFFSET_INIT(page_s_mem, "page", "s_mem");
                ANON_MEMBER_OFFSET_INIT(page_freelist, "page", "freelist");
--
2.31.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux