[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4F3576E5.2000506@att.net>
Date: Fri, 10 Feb 2012 13:58:29 -0600
From: Daniel Santos <danielfsantos@....net>
To: Pekka Enberg <penberg@...nel.org>
CC: Andrew Morton <akpm@...ux-foundation.org>, daniel.santos@...ox.com,
torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: mm/slab.c: remove effectively dead code from kmem_cache_create
I can do that, but it will change the behavior slightly. Currently, if
I write a module and call kmem_cache_create with SLAB_POISON or
SLAB_RED_ZONE when CONFIG_DEBUG_SLAB isn't set (mm/slab.c:2301)
BUG_ON(flags & ~CREATE_MASK) will oops me. If we zero the flags when
CONFIG_DEBUG_SLAB isn't set in slab.h, it will silently ignore these
scenarios. I'm new to Linux kernel programming, so I'm not yet familiar
with its general policies. Let me know if this is acceptable behavior.
Also, I need to make sure that doing so has no other side effects elsewhere.
Daniel
On 02/10/2012 07:06 AM, Pekka Enberg wrote:
> On Thu, 2012-02-09 at 14:39 -0800, Andrew Morton wrote:
>> kmem_cache_create() is called extremely rarely, so the performance
>> benefit here is negligible.
>>
>> We could presumably avoid two of those ifdefs by defining SLAB_RED_ZONE
>> and SLAB_STORE_USER to be zero if !defined(DEBUG). Personally I think
>> that's a bit too subtle and would prefer the explicit ifdefs.
>>
>> In my x86_64 allnoconfig build the patch reduces slab.o's text size
>> from 12859 bytes to 12812. I'll let Pekka decide if that's worth it ;)
> The text savings are worth it but I'd really prefer to see
> include/linux/slab.h patched to define debugging flags as zero for
> non-CONFIG_SLAB_DEBUG and let GCC eliminate the dead code for us.
>
> Pekka
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists