diff options
author | Glauber Costa <glommer@parallels.com> | 2012-12-18 17:22:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 18:02:14 -0500 |
commit | b9ce5ef49f00daf2254c6953c8d31f79aabccd34 (patch) | |
tree | 1da6afdbb3dc2e2d31f588dbfbf502e984af48a6 /mm/slab.c | |
parent | 0e9d92f2d02d8c8320f0502307c688d07bdac2b3 (diff) |
sl[au]b: always get the cache from its page in kmem_cache_free()
struct page already has this information. If we start chaining caches,
this information will always be more trustworthy than whatever is passed
into the function.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: JoonSoo Kim <js1304@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -87,7 +87,6 @@ | |||
87 | */ | 87 | */ |
88 | 88 | ||
89 | #include <linux/slab.h> | 89 | #include <linux/slab.h> |
90 | #include "slab.h" | ||
91 | #include <linux/mm.h> | 90 | #include <linux/mm.h> |
92 | #include <linux/poison.h> | 91 | #include <linux/poison.h> |
93 | #include <linux/swap.h> | 92 | #include <linux/swap.h> |
@@ -128,6 +127,8 @@ | |||
128 | 127 | ||
129 | #include "internal.h" | 128 | #include "internal.h" |
130 | 129 | ||
130 | #include "slab.h" | ||
131 | |||
131 | /* | 132 | /* |
132 | * DEBUG - 1 for kmem_cache_create() to honour; SLAB_RED_ZONE & SLAB_POISON. | 133 | * DEBUG - 1 for kmem_cache_create() to honour; SLAB_RED_ZONE & SLAB_POISON. |
133 | * 0 for faster, smaller code (especially in the critical paths). | 134 | * 0 for faster, smaller code (especially in the critical paths). |
@@ -3883,6 +3884,9 @@ EXPORT_SYMBOL(__kmalloc); | |||
3883 | void kmem_cache_free(struct kmem_cache *cachep, void *objp) | 3884 | void kmem_cache_free(struct kmem_cache *cachep, void *objp) |
3884 | { | 3885 | { |
3885 | unsigned long flags; | 3886 | unsigned long flags; |
3887 | cachep = cache_from_obj(cachep, objp); | ||
3888 | if (!cachep) | ||
3889 | return; | ||
3886 | 3890 | ||
3887 | local_irq_save(flags); | 3891 | local_irq_save(flags); |
3888 | debug_check_no_locks_freed(objp, cachep->object_size); | 3892 | debug_check_no_locks_freed(objp, cachep->object_size); |