diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-06 18:53:13 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-06 18:53:13 -0400 |
| commit | 125b79d74a63552be757bb49a425b965782e4952 (patch) | |
| tree | 978a30e588c070914b679c50ad7ae34d0aff67bc | |
| parent | f1c6872e4980bc4078cfaead05f892b3d78dea64 (diff) | |
| parent | e2087be35a8ed101c1e748ef688c889419c69829 (diff) | |
Merge branch 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux
Pull SLAB changes from Pekka Enberg:
"New and noteworthy:
* More SLAB allocator unification patches from Christoph Lameter and
others. This paves the way for slab memcg patches that hopefully
will land in v3.8.
* SLAB tracing improvements from Ezequiel Garcia.
* Kernel tainting upon SLAB corruption from Dave Jones.
* Miscellanous SLAB allocator bug fixes and improvements from various
people."
* 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux: (43 commits)
slab: Fix build failure in __kmem_cache_create()
slub: init_kmem_cache_cpus() and put_cpu_partial() can be static
mm/slab: Fix kmem_cache_alloc_node_trace() declaration
Revert "mm/slab: Fix kmem_cache_alloc_node_trace() declaration"
mm, slob: fix build breakage in __kmalloc_node_track_caller
mm/slab: Fix kmem_cache_alloc_node_trace() declaration
mm/slab: Fix typo _RET_IP -> _RET_IP_
mm, slub: Rename slab_alloc() -> slab_alloc_node() to match SLAB
mm, slab: Rename __cache_alloc() -> slab_alloc()
mm, slab: Match SLAB and SLUB kmem_cache_alloc_xxx_trace() prototype
mm, slab: Replace 'caller' type, void* -> unsigned long
mm, slob: Add support for kmalloc_track_caller()
mm, slab: Remove silly function slab_buffer_size()
mm, slob: Use NUMA_NO_NODE instead of -1
mm, sl[au]b: Taint kernel when we detect a corrupted slab
slab: Only define slab_error for DEBUG
slab: fix the DEADLOCK issue on l3 alien lock
slub: Zero initial memory segment for kmem_cache and kmem_cache_node
Revert "mm/sl[aou]b: Move sysfs_slab_add to common"
mm/sl[aou]b: Move kmem_cache refcounting to common code
...
| -rw-r--r-- | include/linux/slab.h | 6 | ||||
| -rw-r--r-- | include/linux/slab_def.h | 27 | ||||
| -rw-r--r-- | include/linux/slob_def.h | 6 | ||||
| -rw-r--r-- | mm/slab.c | 348 | ||||
| -rw-r--r-- | mm/slab.h | 19 | ||||
| -rw-r--r-- | mm/slab_common.c | 159 | ||||
| -rw-r--r-- | mm/slob.c | 91 | ||||
| -rw-r--r-- | mm/slub.c | 208 | ||||
| -rw-r--r-- | mm/util.c | 35 |
9 files changed, 463 insertions, 436 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 0dd2dfa7beca..83d1a1454b7e 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -321,7 +321,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep, | |||
| 321 | * request comes from. | 321 | * request comes from. |
| 322 | */ | 322 | */ |
| 323 | #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ | 323 | #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ |
| 324 | (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) | 324 | (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \ |
| 325 | (defined(CONFIG_SLOB) && defined(CONFIG_TRACING)) | ||
| 325 | extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); | 326 | extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); |
| 326 | #define kmalloc_track_caller(size, flags) \ | 327 | #define kmalloc_track_caller(size, flags) \ |
| 327 | __kmalloc_track_caller(size, flags, _RET_IP_) | 328 | __kmalloc_track_caller(size, flags, _RET_IP_) |
| @@ -340,7 +341,8 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); | |||
| 340 | * allocation request comes from. | 341 | * allocation request comes from. |
| 341 | */ | 342 | */ |
| 342 | #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ | 343 | #if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ |
| 343 | (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) | 344 | (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \ |
| 345 | (defined(CONFIG_SLOB) && defined(CONFIG_TRACING)) | ||
| 344 | extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); | 346 | extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); |
| 345 | #define kmalloc_node_track_caller(size, flags, node) \ | 347 | #define kmalloc_node_track_caller(size, flags, node) \ |
| 346 | __kmalloc_node_track_caller(size, flags, node, \ | 348 | __kmalloc_node_track_caller(size, flags, node, \ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 0c634fa376c9..cc290f0bdb34 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -45,7 +45,6 @@ struct kmem_cache { | |||
| 45 | unsigned int colour_off; /* colour offset */ | 45 | unsigned int colour_off; /* colour offset */ |
| 46 | struct kmem_cache *slabp_cache; | 46 | struct kmem_cache *slabp_cache; |
| 47 | unsigned int slab_size; | 47 | unsigned int slab_size; |
| 48 | unsigned int dflags; /* dynamic flags */ | ||
| 49 | 48 | ||
| 50 | /* constructor func */ | 49 | /* constructor func */ |
| 51 | void (*ctor)(void *obj); | 50 | void (*ctor)(void *obj); |
| @@ -112,19 +111,13 @@ void *kmem_cache_alloc(struct kmem_cache *, gfp_t); | |||
| 112 | void *__kmalloc(size_t size, gfp_t flags); | 111 | void *__kmalloc(size_t size, gfp_t flags); |
| 113 | 112 | ||
| 114 | #ifdef CONFIG_TRACING | 113 | #ifdef CONFIG_TRACING |
| 115 | extern void *kmem_cache_alloc_trace(size_t size, | 114 | extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t); |
| 116 | struct kmem_cache *cachep, gfp_t flags); | ||
| 117 | extern size_t slab_buffer_size(struct kmem_cache *cachep); | ||
| 118 | #else | 115 | #else |
| 119 | static __always_inline void * | 116 | static __always_inline void * |
| 120 | kmem_cache_alloc_trace(size_t size, struct kmem_cache *cachep, gfp_t flags) | 117 | kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size) |
| 121 | { | 118 | { |
| 122 | return kmem_cache_alloc(cachep, flags); | 119 | return kmem_cache_alloc(cachep, flags); |
| 123 | } | 120 | } |
| 124 | static inline size_t slab_buffer_size(struct kmem_cache *cachep) | ||
| 125 | { | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | #endif | 121 | #endif |
| 129 | 122 | ||
| 130 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 123 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
| @@ -154,7 +147,7 @@ found: | |||
| 154 | #endif | 147 | #endif |
| 155 | cachep = malloc_sizes[i].cs_cachep; | 148 | cachep = malloc_sizes[i].cs_cachep; |
| 156 | 149 | ||
| 157 | ret = kmem_cache_alloc_trace(size, cachep, flags); | 150 | ret = kmem_cache_alloc_trace(cachep, flags, size); |
| 158 | 151 | ||
| 159 | return ret; | 152 | return ret; |
| 160 | } | 153 | } |
| @@ -166,16 +159,16 @@ extern void *__kmalloc_node(size_t size, gfp_t flags, int node); | |||
| 166 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 159 | extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 167 | 160 | ||
| 168 | #ifdef CONFIG_TRACING | 161 | #ifdef CONFIG_TRACING |
| 169 | extern void *kmem_cache_alloc_node_trace(size_t size, | 162 | extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep, |
| 170 | struct kmem_cache *cachep, | ||
| 171 | gfp_t flags, | 163 | gfp_t flags, |
| 172 | int nodeid); | 164 | int nodeid, |
| 165 | size_t size); | ||
| 173 | #else | 166 | #else |
| 174 | static __always_inline void * | 167 | static __always_inline void * |
| 175 | kmem_cache_alloc_node_trace(size_t size, | 168 | kmem_cache_alloc_node_trace(struct kmem_cache *cachep, |
| 176 | struct kmem_cache *cachep, | ||
| 177 | gfp_t flags, | 169 | gfp_t flags, |
| 178 | int nodeid) | 170 | int nodeid, |
| 171 | size_t size) | ||
| 179 | { | 172 | { |
| 180 | return kmem_cache_alloc_node(cachep, flags, nodeid); | 173 | return kmem_cache_alloc_node(cachep, flags, nodeid); |
| 181 | } | 174 | } |
| @@ -207,7 +200,7 @@ found: | |||
| 207 | #endif | 200 | #endif |
| 208 | cachep = malloc_sizes[i].cs_cachep; | 201 | cachep = malloc_sizes[i].cs_cachep; |
| 209 | 202 | ||
| 210 | return kmem_cache_alloc_node_trace(size, cachep, flags, node); | 203 | return kmem_cache_alloc_node_trace(cachep, flags, node, size); |
| 211 | } | 204 | } |
| 212 | return __kmalloc_node(size, flags, node); | 205 | return __kmalloc_node(size, flags, node); |
| 213 | } | 206 | } |
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h index 0ec00b39d006..f28e14a12e3f 100644 --- a/include/linux/slob_def.h +++ b/include/linux/slob_def.h | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | #ifndef __LINUX_SLOB_DEF_H | 1 | #ifndef __LINUX_SLOB_DEF_H |
| 2 | #define __LINUX_SLOB_DEF_H | 2 | #define __LINUX_SLOB_DEF_H |
| 3 | 3 | ||
| 4 | #include <linux/numa.h> | ||
| 5 | |||
| 4 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); | 6 | void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); |
| 5 | 7 | ||
| 6 | static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, | 8 | static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, |
| 7 | gfp_t flags) | 9 | gfp_t flags) |
| 8 | { | 10 | { |
| 9 | return kmem_cache_alloc_node(cachep, flags, -1); | 11 | return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE); |
| 10 | } | 12 | } |
| 11 | 13 | ||
| 12 | void *__kmalloc_node(size_t size, gfp_t flags, int node); | 14 | void *__kmalloc_node(size_t size, gfp_t flags, int node); |
| @@ -26,7 +28,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) | |||
| 26 | */ | 28 | */ |
| 27 | static __always_inline void *kmalloc(size_t size, gfp_t flags) | 29 | static __always_inline void *kmalloc(size_t size, gfp_t flags) |
| 28 | { | 30 | { |
| 29 | return __kmalloc_node(size, flags, -1); | 31 | return __kmalloc_node(size, flags, NUMA_NO_NODE); |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | static __always_inline void *__kmalloc(size_t size, gfp_t flags) | 34 | static __always_inline void *__kmalloc(size_t size, gfp_t flags) |
| @@ -498,14 +498,6 @@ static void **dbg_userword(struct kmem_cache *cachep, void *objp) | |||
| 498 | 498 | ||
| 499 | #endif | 499 | #endif |
| 500 | 500 | ||
| 501 | #ifdef CONFIG_TRACING | ||
| 502 | size_t slab_buffer_size(struct kmem_cache *cachep) | ||
| 503 | { | ||
| 504 | return cachep->size; | ||
| 505 | } | ||
| 506 | EXPORT_SYMBOL(slab_buffer_size); | ||
| 507 | #endif | ||
| 508 | |||
| 509 | /* | 501 | /* |
| 510 | * Do not go above this order unless 0 objects fit into the slab or | 502 | * Do not go above this order unless 0 objects fit into the slab or |
| 511 | * overridden on the command line. | 503 | * overridden on the command line. |
| @@ -515,13 +507,6 @@ EXPORT_SYMBOL(slab_buffer_size); | |||
| 515 | static int slab_max_order = SLAB_MAX_ORDER_LO; | 507 | static int slab_max_order = SLAB_MAX_ORDER_LO; |
| 516 | static bool slab_max_order_set __initdata; | 508 | static bool slab_max_order_set __initdata; |
| 517 | 509 | ||
| 518 | static inline struct kmem_cache *page_get_cache(struct page *page) | ||
| 519 | { | ||
| 520 | page = compound_head(page); | ||
| 521 | BUG_ON(!PageSlab(page)); | ||
| 522 | return page->slab_cache; | ||
| 523 | } | ||
| 524 | |||
| 525 | static inline struct kmem_cache *virt_to_cache(const void *obj) | ||
