mm/slab_common.c: mark kmalloc machinery as __ro_after_init

kmalloc caches aren't relocated after being set up neither does
"size_index" array.

Link: http://lkml.kernel.org/r/20180226203519.GA6886@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexey Dobriyan 2018-04-05 16:20:11 -07:00 committed by Linus Torvalds
parent 849cf55963
commit 1c99ba2918
1 changed files with 4 additions and 3 deletions

View File

@ -10,6 +10,7 @@
#include <linux/poison.h> #include <linux/poison.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/memory.h> #include <linux/memory.h>
#include <linux/cache.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/cpu.h> #include <linux/cpu.h>
@ -954,11 +955,11 @@ struct kmem_cache *__init create_kmalloc_cache(const char *name, size_t size,
return s; return s;
} }
struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1] __ro_after_init;
EXPORT_SYMBOL(kmalloc_caches); EXPORT_SYMBOL(kmalloc_caches);
#ifdef CONFIG_ZONE_DMA #ifdef CONFIG_ZONE_DMA
struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1]; struct kmem_cache *kmalloc_dma_caches[KMALLOC_SHIFT_HIGH + 1] __ro_after_init;
EXPORT_SYMBOL(kmalloc_dma_caches); EXPORT_SYMBOL(kmalloc_dma_caches);
#endif #endif
@ -968,7 +969,7 @@ EXPORT_SYMBOL(kmalloc_dma_caches);
* of two cache sizes there. The size of larger slabs can be determined using * of two cache sizes there. The size of larger slabs can be determined using
* fls. * fls.
*/ */
static s8 size_index[24] = { static s8 size_index[24] __ro_after_init = {
3, /* 8 */ 3, /* 8 */
4, /* 16 */ 4, /* 16 */
5, /* 24 */ 5, /* 24 */