You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Linus Torvalds
parent
0e9d92f2d0
commit
b9ce5ef49f
@@ -2611,19 +2611,10 @@ redo:
|
||||
|
||||
void kmem_cache_free(struct kmem_cache *s, void *x)
|
||||
{
|
||||
struct page *page;
|
||||
|
||||
page = virt_to_head_page(x);
|
||||
|
||||
if (kmem_cache_debug(s) && page->slab_cache != s) {
|
||||
pr_err("kmem_cache_free: Wrong slab cache. %s but object"
|
||||
" is from %s\n", page->slab_cache->name, s->name);
|
||||
WARN_ON_ONCE(1);
|
||||
s = cache_from_obj(s, x);
|
||||
if (!s)
|
||||
return;
|
||||
}
|
||||
|
||||
slab_free(s, page, x, _RET_IP_);
|
||||
|
||||
slab_free(s, virt_to_head_page(x), x, _RET_IP_);
|
||||
trace_kmem_cache_free(_RET_IP_, x);
|
||||
}
|
||||
EXPORT_SYMBOL(kmem_cache_free);
|
||||
|
||||
Reference in New Issue
Block a user