From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754279Ab3I0Uik (ORCPT ); Fri, 27 Sep 2013 16:38:40 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:36059 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753308Ab3I0Uij (ORCPT ); Fri, 27 Sep 2013 16:38:39 -0400 Message-ID: <5245ECC3.8070200@gmail.com> Date: Fri, 27 Sep 2013 13:38:27 -0700 From: Frank Rowand Reply-To: frowand.list@gmail.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Christoph Lameter , Pekka Enberg , Matt Mackall , linux-mm@kvack.org, Linux Kernel list , Catalin Marinas , "Bobniev, Roman" CC: "Bird, Tim" , =?ISO-8859-1?Q?=22Andersson=2C?= =?ISO-8859-1?Q?_Bj=F6rn=22?= Subject: [PATCH] slub: Proper kmemleak tracking if CONFIG_SLUB_DEBUG disabled Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Bobniev When kmemleak checking is enabled and CONFIG_SLUB_DEBUG is disabled, the kmemleak code for small block allocation is disabled. This results in false kmemleak errors when memory is freed. Move the kmemleak code for small block allocation out from under CONFIG_SLUB_DEBUG. Signed-off-by: Roman Bobniev Signed-off-by: Frank Rowand --- mm/slub.c | 6 3 + 3 - 0 ! 1 file changed, 3 insertions(+), 3 deletions(-) Index: b/mm/slub.c =================================================================== --- a/mm/slub.c +++ b/mm/slub.c @@ -947,13 +947,10 @@ static inline void slab_post_alloc_hook( { flags &= gfp_allowed_mask; kmemcheck_slab_alloc(s, flags, object, slab_ksize(s)); - kmemleak_alloc_recursive(object, s->object_size, 1, s->flags, flags); } static inline void slab_free_hook(struct kmem_cache *s, void *x) { - kmemleak_free_recursive(x, s->flags); - /* * Trouble is that we may no longer disable interupts in the fast path * So in order to make the debug calls that expect irqs to be @@ -2418,6 +2415,8 @@ redo: memset(object, 0, s->object_size); slab_post_alloc_hook(s, gfpflags, object); + kmemleak_alloc_recursive(object, s->objsize, 1, s->flags, + gfpflags & gfp_allowed_mask); return object; } @@ -2614,6 +2613,7 @@ static __always_inline void slab_free(st struct kmem_cache_cpu *c; unsigned long tid; + kmemleak_free_recursive(x, s->flags); slab_free_hook(s, x); redo: