diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 18:04:26 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-28 18:04:26 -0400 |
| commit | 0c9aac08261512d70d7d4817bd222abca8b6bdd6 (patch) | |
| tree | 41bbfed632bfc6233eac3e936cfdce75c5bd3a8f /include/linux | |
| parent | ed0bb8ea059764c3fc882fb135473afd347335e9 (diff) | |
| parent | 8bdec192b40cf7f7eec170b317c76089eb5eeddb (diff) | |
Merge branch 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux
Pull SLAB changes from Pekka Enberg:
"There's the new kmalloc_array() API, minor fixes and performance
improvements, but quite honestly, nothing terribly exciting."
* 'slab/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/linux:
mm: SLAB Out-of-memory diagnostics
slab: introduce kmalloc_array()
slub: per cpu partial statistics change
slub: include include for prefetch
slub: Do not hold slub_lock when calling sysfs_slab_add()
slub: prefetch next freelist pointer in slab_alloc()
slab, cleanup: remove unneeded return
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/slab.h | 17 | ||||
| -rw-r--r-- | include/linux/slub_def.h | 6 |
2 files changed, 18 insertions, 5 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 573c809c33d9..a595dce6b0c7 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -190,7 +190,7 @@ size_t ksize(const void *); | |||
| 190 | #endif | 190 | #endif |
| 191 | 191 | ||
| 192 | /** | 192 | /** |
| 193 | * kcalloc - allocate memory for an array. The memory is set to zero. | 193 | * kmalloc_array - allocate memory for an array. |
| 194 | * @n: number of elements. | 194 | * @n: number of elements. |
| 195 | * @size: element size. | 195 | * @size: element size. |
| 196 | * @flags: the type of memory to allocate. | 196 | * @flags: the type of memory to allocate. |
| @@ -240,11 +240,22 @@ size_t ksize(const void *); | |||
| 240 | * for general use, and so are not documented here. For a full list of | 240 | * for general use, and so are not documented here. For a full list of |
| 241 | * potential flags, always refer to linux/gfp.h. | 241 | * potential flags, always refer to linux/gfp.h. |
| 242 | */ | 242 | */ |
| 243 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | 243 | static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags) |
| 244 | { | 244 | { |
| 245 | if (size != 0 && n > ULONG_MAX / size) | 245 | if (size != 0 && n > ULONG_MAX / size) |
| 246 | return NULL; | 246 | return NULL; |
| 247 | return __kmalloc(n * size, flags | __GFP_ZERO); | 247 | return __kmalloc(n * size, flags); |
| 248 | } | ||
| 249 | |||
| 250 | /** | ||
| 251 | * kcalloc - allocate memory for an array. The memory is set to zero. | ||
| 252 | * @n: number of elements. | ||
| 253 | * @size: element size. | ||
| 254 | * @flags: the type of memory to allocate (see kmalloc). | ||
| 255 | */ | ||
| 256 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | ||
| 257 | { | ||
| 258 | return kmalloc_array(n, size, flags | __GFP_ZERO); | ||
| 248 | } | 259 | } |
| 249 | 260 | ||
| 250 | #if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) | 261 | #if !defined(CONFIG_NUMA) && !defined(CONFIG_SLOB) |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index ca122b36aec1..c2f8c8bc56ed 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -22,7 +22,7 @@ enum stat_item { | |||
| 22 | FREE_FROZEN, /* Freeing to frozen slab */ | 22 | FREE_FROZEN, /* Freeing to frozen slab */ |
| 23 | FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ | 23 | FREE_ADD_PARTIAL, /* Freeing moves slab to partial list */ |
| 24 | FREE_REMOVE_PARTIAL, /* Freeing removes last object */ | 24 | FREE_REMOVE_PARTIAL, /* Freeing removes last object */ |
| 25 | ALLOC_FROM_PARTIAL, /* Cpu slab acquired from partial list */ | 25 | ALLOC_FROM_PARTIAL, /* Cpu slab acquired from node partial list */ |
| 26 | ALLOC_SLAB, /* Cpu slab acquired from page allocator */ | 26 | ALLOC_SLAB, /* Cpu slab acquired from page allocator */ |
| 27 | ALLOC_REFILL, /* Refill cpu slab from slab freelist */ | 27 | ALLOC_REFILL, /* Refill cpu slab from slab freelist */ |
| 28 | ALLOC_NODE_MISMATCH, /* Switching cpu slab */ | 28 | ALLOC_NODE_MISMATCH, /* Switching cpu slab */ |
| @@ -38,7 +38,9 @@ enum stat_item { | |||
| 38 | CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ | 38 | CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */ |
| 39 | CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */ | 39 | CMPXCHG_DOUBLE_FAIL, /* Number of times that cmpxchg double did not match */ |
| 40 | CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ | 40 | CPU_PARTIAL_ALLOC, /* Used cpu partial on alloc */ |
| 41 | CPU_PARTIAL_FREE, /* USed cpu partial on free */ | 41 | CPU_PARTIAL_FREE, /* Refill cpu partial on free */ |
| 42 | CPU_PARTIAL_NODE, /* Refill cpu partial from node partial */ | ||
| 43 | CPU_PARTIAL_DRAIN, /* Drain cpu partial to node partial */ | ||
| 42 | NR_SLUB_STAT_ITEMS }; | 44 | NR_SLUB_STAT_ITEMS }; |
| 43 | 45 | ||
| 44 | struct kmem_cache_cpu { | 46 | struct kmem_cache_cpu { |
