From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx142.postini.com [74.125.245.142]) by kanga.kvack.org (Postfix) with SMTP id 092DE6B005D for ; Tue, 31 Jul 2012 13:36:35 -0400 (EDT) Message-Id: <20120731173634.162543139@linux.com> Date: Tue, 31 Jul 2012 12:36:21 -0500 From: Christoph Lameter Subject: Common [1/9] slub: Add debugging to verify correct cache use on kmem_cache_free() References: <20120731173620.432853182@linux.com> Content-Disposition: inline; filename=slub_new_debug Sender: owner-linux-mm@kvack.org List-ID: To: Pekka Enberg Cc: linux-mm@kvack.org, David Rientjes , Matt Mackall , Glauber Costa , Joonsoo Kim Add additional debugging to check that the objects is actually from the cache the caller claims. Doing so currently trips up some other debugging code. It takes a lot to infer from that what was happening. Signed-off-by: Christoph Lameter Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2012-07-31 11:46:01.544493395 -0500 +++ linux-2.6/mm/slub.c 2012-07-31 11:53:21.832078581 -0500 @@ -2583,6 +2583,13 @@ page = virt_to_head_page(x); + if (kmem_cache_debug(s) && page->slab != s) { + printk("kmem_cache_free: Wrong slab cache. %s but object" + " is from %s\n", page->slab->name, s->name); + WARN_ON(1); + return; + } + slab_free(s, page, x, _RET_IP_); trace_kmem_cache_free(_RET_IP_, x); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org