Commit 1b27d05b authored by Pekka Enberg's avatar Pekka Enberg Committed by Linus Torvalds

mm: move cache_line_size() to <linux/cache.h>

Not all architectures define cache_line_size() so as suggested by Andrew move
the private implementations in mm/slab.c and mm/slob.c to <linux/cache.h>.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Reviewed-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 19fc3f0a
...@@ -114,6 +114,9 @@ config GENERIC_TIME_VSYSCALL ...@@ -114,6 +114,9 @@ config GENERIC_TIME_VSYSCALL
config ARCH_HAS_CPU_RELAX config ARCH_HAS_CPU_RELAX
def_bool y def_bool y
config ARCH_HAS_CACHE_LINE_SIZE
def_bool y
config HAVE_SETUP_PER_CPU_AREA config HAVE_SETUP_PER_CPU_AREA
def_bool X86_64 || (X86_SMP && !X86_VOYAGER) def_bool X86_64 || (X86_SMP && !X86_VOYAGER)
......
...@@ -60,4 +60,8 @@ ...@@ -60,4 +60,8 @@
#endif #endif
#endif #endif
#ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
#define cache_line_size() L1_CACHE_BYTES
#endif
#endif /* __LINUX_CACHE_H */ #endif /* __LINUX_CACHE_H */
...@@ -139,10 +139,6 @@ ...@@ -139,10 +139,6 @@
#define BYTES_PER_WORD sizeof(void *) #define BYTES_PER_WORD sizeof(void *)
#define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long)) #define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long))
#ifndef cache_line_size
#define cache_line_size() L1_CACHE_BYTES
#endif
#ifndef ARCH_KMALLOC_MINALIGN #ifndef ARCH_KMALLOC_MINALIGN
/* /*
* Enforce a minimum alignment for the kmalloc caches. * Enforce a minimum alignment for the kmalloc caches.
......
...@@ -207,11 +207,6 @@ static inline void ClearSlabDebug(struct page *page) ...@@ -207,11 +207,6 @@ static inline void ClearSlabDebug(struct page *page)
#define __KMALLOC_CACHE 0x20000000 /* objects freed using kfree */ #define __KMALLOC_CACHE 0x20000000 /* objects freed using kfree */
#define __PAGE_ALLOC_FALLBACK 0x10000000 /* Allow fallback to page alloc */ #define __PAGE_ALLOC_FALLBACK 0x10000000 /* Allow fallback to page alloc */
/* Not all arches define cache_line_size */
#ifndef cache_line_size
#define cache_line_size() L1_CACHE_BYTES
#endif
static int kmem_size = sizeof(struct kmem_cache); static int kmem_size = sizeof(struct kmem_cache);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment