From 40d396eb36139df03ea00eb1b70b4c18d283ce34 Mon Sep 17 00:00:00 2001 From: Rohit Agarwal Date: Thu, 18 Jan 2024 13:04:58 +0530 Subject: [PATCH] mm: slub: Declare slab_owner_ops only when SLUB DEBUG is enabled Declare the ops struct and corresponding callbacks only when SLUB_DEBUG is enabled. Currently, the ops is defined only under MINIDUMP_PANIC_DUMP config but the variables it uses are protected under SLUB_DEBUG as well. Change-Id: I11f29564e1d65edc506a50e2c12aac374dbca6d5 Signed-off-by: Rohit Agarwal --- mm/slub.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 3cc6ee044f27..f558c25a6206 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -6240,6 +6240,7 @@ static int sysfs_slab_alias(struct kmem_cache *s, const char *name) return 0; } +#ifdef CONFIG_SLUB_DEBUG #ifdef CONFIG_QCOM_MINIDUMP_PANIC_DUMP static ssize_t slab_owner_filter_write(struct file *file, const char __user *ubuf, @@ -6321,7 +6322,8 @@ static const struct file_operations proc_slab_owner_handle_ops = { .write = slab_owner_handle_write, .read = slab_owner_handle_read, }; -#endif +#endif /* CONFIG_QCOM_MINIDUMP_PANIC_DUMP */ +#endif /* CONFIG_SLUB_DEBUG */ static int __init slab_sysfs_init(void) { @@ -6366,6 +6368,7 @@ static int __init slab_sysfs_init(void) kfree(al); } +#ifdef CONFIG_SLUB_DEBUG #ifdef CONFIG_QCOM_MINIDUMP_PANIC_DUMP if (slub_debug) { int i; @@ -6380,6 +6383,7 @@ static int __init slab_sysfs_init(void) set_bit(i, &slab_owner_filter); } } +#endif #endif mutex_unlock(&slab_mutex); resiliency_test();