diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2021-11-10 16:12:45 +0300 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-01-06 14:26:53 +0300 |
commit | 9c01e9af171f13cf6573f404ecaf96dfa48233ab (patch) | |
tree | 1af8f4560e4f707a0587cd9febe0ac34605f3abd /mm/slab.h | |
parent | 662188c3a20eba75babc5a910a5f1b4278069f85 (diff) | |
download | linux-9c01e9af171f13cf6573f404ecaf96dfa48233ab.tar.xz |
mm/slub: Define struct slab fields for CONFIG_SLUB_CPU_PARTIAL only when enabled
The fields 'next' and 'slabs' are only used when CONFIG_SLUB_CPU_PARTIAL
is enabled. We can put their definition to #ifdef to prevent accidental
use when disabled.
Currenlty show_slab_objects() and slabs_cpu_partial_show() contain code
accessing the slabs field that's effectively dead with
CONFIG_SLUB_CPU_PARTIAL=n through the wrappers slub_percpu_partial() and
slub_percpu_partial_read_once(), but to prevent a compile error, we need
to hide all this code behind #ifdef.
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reviewed-by: Roman Gushchin <guro@fb.com>
Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/slab.h b/mm/slab.h index 495008f89bf6..f14e723b9e3c 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -25,10 +25,12 @@ struct slab { union { struct list_head slab_list; struct rcu_head rcu_head; +#ifdef CONFIG_SLUB_CPU_PARTIAL struct { struct slab *next; int slabs; /* Nr of slabs left */ }; +#endif }; struct kmem_cache *slab_cache; /* Double-word boundary */ |