Re: [RFC V2 SLEB 03/14] SLUB: Use kmem_cache flags to detect if Slab is in debugging mode.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 21 May 2010, Christoph Lameter wrote:

> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c	2010-04-27 12:41:05.000000000 -0500
> +++ linux-2.6/mm/slub.c	2010-04-27 13:15:32.000000000 -0500
> @@ -107,11 +107,17 @@
>   * 			the fast path and disables lockless freelists.
>   */
>  
> +#define SLAB_DEBUG_FLAGS (SLAB_RED_ZONE | SLAB_POISON | SLAB_STORE_USER | \
> +		SLAB_TRACE | SLAB_DEBUG_FREE)
> +
> +static inline int debug_on(struct kmem_cache *s)
> +{
>  #ifdef CONFIG_SLUB_DEBUG
> -#define SLABDEBUG 1
> +	return unlikely(s->flags & SLAB_DEBUG_FLAGS);
>  #else
> -#define SLABDEBUG 0
> +	return 0;
>  #endif
> +}
>  
>  /*
>   * Issues still to be resolved:

Nice optimization!  I'd recommend a non-generic name for this check, 
though, such as cache_debug_on().

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]