Commit 40779859 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
  SLAB: Record actual last user of freed objects.
  slub: always align cpu_slab to honor cmpxchg_double requirement
parents ffdb8f1b a947eb95
...@@ -259,6 +259,9 @@ extern void __bad_size_call_parameter(void); ...@@ -259,6 +259,9 @@ extern void __bad_size_call_parameter(void);
* Special handling for cmpxchg_double. cmpxchg_double is passed two * Special handling for cmpxchg_double. cmpxchg_double is passed two
* percpu variables. The first has to be aligned to a double word * percpu variables. The first has to be aligned to a double word
* boundary and the second has to follow directly thereafter. * boundary and the second has to follow directly thereafter.
* We enforce this on all architectures even if they don't support
* a double cmpxchg instruction, since it's a cheap requirement, and it
* avoids breaking the requirement for architectures with the instruction.
*/ */
#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \ #define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
({ \ ({ \
......
...@@ -3604,13 +3604,14 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac) ...@@ -3604,13 +3604,14 @@ static void cache_flusharray(struct kmem_cache *cachep, struct array_cache *ac)
* Release an obj back to its cache. If the obj has a constructed state, it must * Release an obj back to its cache. If the obj has a constructed state, it must
* be in this state _before_ it is released. Called with disabled ints. * be in this state _before_ it is released. Called with disabled ints.
*/ */
static inline void __cache_free(struct kmem_cache *cachep, void *objp) static inline void __cache_free(struct kmem_cache *cachep, void *objp,
void *caller)
{ {
struct array_cache *ac = cpu_cache_get(cachep); struct array_cache *ac = cpu_cache_get(cachep);
check_irq_off(); check_irq_off();
kmemleak_free_recursive(objp, cachep->flags); kmemleak_free_recursive(objp, cachep->flags);
objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0)); objp = cache_free_debugcheck(cachep, objp, caller);
kmemcheck_slab_free(cachep, objp, obj_size(cachep)); kmemcheck_slab_free(cachep, objp, obj_size(cachep));
...@@ -3801,7 +3802,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) ...@@ -3801,7 +3802,7 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp)
debug_check_no_locks_freed(objp, obj_size(cachep)); debug_check_no_locks_freed(objp, obj_size(cachep));
if (!(cachep->flags & SLAB_DEBUG_OBJECTS)) if (!(cachep->flags & SLAB_DEBUG_OBJECTS))
debug_check_no_obj_freed(objp, obj_size(cachep)); debug_check_no_obj_freed(objp, obj_size(cachep));
__cache_free(cachep, objp); __cache_free(cachep, objp, __builtin_return_address(0));
local_irq_restore(flags); local_irq_restore(flags);
trace_kmem_cache_free(_RET_IP_, objp); trace_kmem_cache_free(_RET_IP_, objp);
...@@ -3831,7 +3832,7 @@ void kfree(const void *objp) ...@@ -3831,7 +3832,7 @@ void kfree(const void *objp)
c = virt_to_cache(objp); c = virt_to_cache(objp);
debug_check_no_locks_freed(objp, obj_size(c)); debug_check_no_locks_freed(objp, obj_size(c));
debug_check_no_obj_freed(objp, obj_size(c)); debug_check_no_obj_freed(objp, obj_size(c));
__cache_free(c, (void *)objp); __cache_free(c, (void *)objp, __builtin_return_address(0));
local_irq_restore(flags); local_irq_restore(flags);
} }
EXPORT_SYMBOL(kfree); EXPORT_SYMBOL(kfree);
......
...@@ -2320,16 +2320,12 @@ static inline int alloc_kmem_cache_cpus(struct kmem_cache *s) ...@@ -2320,16 +2320,12 @@ static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE < BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu)); SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
#ifdef CONFIG_CMPXCHG_LOCAL
/* /*
* Must align to double word boundary for the double cmpxchg instructions * Must align to double word boundary for the double cmpxchg
* to work. * instructions to work; see __pcpu_double_call_return_bool().
*/ */
s->cpu_slab = __alloc_percpu(sizeof(struct kmem_cache_cpu), 2 * sizeof(void *)); s->cpu_slab = __alloc_percpu(sizeof(struct kmem_cache_cpu),
#else 2 * sizeof(void *));
/* Regular alignment is sufficient */
s->cpu_slab = alloc_percpu(struct kmem_cache_cpu);
#endif
if (!s->cpu_slab) if (!s->cpu_slab)
return 0; return 0;
......
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