aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-04-28 05:12:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 11:58:19 -0400
commit1b27d05b6e21249d2338be26dfcbe8f8d8ff8a5b (patch)
treec5413d5f64efed1aa84bfa0ab718f1e2a2f6f9cb
parent19fc3f0acde32636529969570055c7e2a744787c (diff)
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: Christoph Lameter <clameter@sgi.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/x86/Kconfig3
-rw-r--r--include/linux/cache.h4
-rw-r--r--mm/slab.c4
-rw-r--r--mm/slub.c5
4 files changed, 7 insertions, 9 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e5790fe9e330..a8ce13a54764 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -114,6 +114,9 @@ config GENERIC_TIME_VSYSCALL
114config ARCH_HAS_CPU_RELAX 114config ARCH_HAS_CPU_RELAX
115 def_bool y 115 def_bool y
116 116
117config ARCH_HAS_CACHE_LINE_SIZE
118 def_bool y
119
117config HAVE_SETUP_PER_CPU_AREA 120config HAVE_SETUP_PER_CPU_AREA
118 def_bool X86_64 || (X86_SMP && !X86_VOYAGER) 121 def_bool X86_64 || (X86_SMP && !X86_VOYAGER)
119 122
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4552504c0228..97e24881c4c6 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -60,4 +60,8 @@
60#endif 60#endif
61#endif 61#endif
62 62
63#ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
64#define cache_line_size() L1_CACHE_BYTES
65#endif
66
63#endif /* __LINUX_CACHE_H */ 67#endif /* __LINUX_CACHE_H */
diff --git a/mm/slab.c b/mm/slab.c
index 7bc4a136846e..39d20f8a0791 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -139,10 +139,6 @@
139#define BYTES_PER_WORD sizeof(void *) 139#define BYTES_PER_WORD sizeof(void *)
140#define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long)) 140#define REDZONE_ALIGN max(BYTES_PER_WORD, __alignof__(unsigned long long))
141 141
142#ifndef cache_line_size
143#define cache_line_size() L1_CACHE_BYTES
144#endif
145
146#ifndef ARCH_KMALLOC_MINALIGN 142#ifndef ARCH_KMALLOC_MINALIGN
147/* 143/*
148 * Enforce a minimum alignment for the kmalloc caches. 144 * Enforce a minimum alignment for the kmalloc caches.
diff --git a/mm/slub.c b/mm/slub.c
index 48fff83a1e9d..38914bc64aca 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -207,11 +207,6 @@ static inline void ClearSlabDebug(struct page *page)
207#define __KMALLOC_CACHE 0x20000000 /* objects freed using kfree */ 207#define __KMALLOC_CACHE 0x20000000 /* objects freed using kfree */
208#define __PAGE_ALLOC_FALLBACK 0x10000000 /* Allow fallback to page alloc */ 208#define __PAGE_ALLOC_FALLBACK 0x10000000 /* Allow fallback to page alloc */
209 209
210/* Not all arches define cache_line_size */
211#ifndef cache_line_size
212#define cache_line_size() L1_CACHE_BYTES
213#endif
214
215static int kmem_size = sizeof(struct kmem_cache); 210static int kmem_size = sizeof(struct kmem_cache);
216 211
217#ifdef CONFIG_SMP 212#ifdef CONFIG_SMP