lkml.org 
[lkml]   [2007]   [Aug]   [23]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
 
Messages in this thread
/
SubjectRe: [patch 4/6] SLUB: Avoid touching page struct when freeing to per cpu slab
FromPeter Zijlstra <>
DateThu, 23 Aug 2007 17:05:58 +0200
On Wed, 2007-08-22 at 23:46 -0700, Christoph Lameter wrote:
> plain text document attachment
> (0008-SLUB-Avoid-touching-page-struct-when-freeing-to-per.patch)
> Set c->node to -1 if we allocate from a debug slab instead for SlabDebug
> which requires access the page struct cacheline.

this relies on node_match() which will only ever return !1 when
CONFIG_NUMA

> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> ---
>  mm/slub.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.23-rc3-mm1/mm/slub.c
> ===================================================================
> --- linux-2.6.23-rc3-mm1.orig/mm/slub.c	2007-08-22 17:20:28.000000000 -0700
> +++ linux-2.6.23-rc3-mm1/mm/slub.c	2007-08-22 17:20:33.000000000 -0700
> @@ -1517,6 +1517,7 @@ debug:
> 
>  	c->page->inuse++;
>  	c->page->freelist = object[c->offset];
> +	c->node = -1;
>  	slab_unlock(c->page);
>  	return object;
>  }
> @@ -1540,8 +1541,7 @@ static void __always_inline *slab_alloc(
> 
>  	local_irq_save(flags);
>  	c = get_cpu_slab(s, smp_processor_id());
> -	if (unlikely(!c->page || !c->freelist ||
> -					!node_match(c, node)))
> +	if (unlikely(!c->freelist || !node_match(c, node)))
> 
>  		object = __slab_alloc(s, gfpflags, node, addr, c);
> 
> @@ -1650,7 +1650,7 @@ static void __always_inline slab_free(st
>  	local_irq_save(flags);
>  	debug_check_no_locks_freed(object, s->objsize);
>  	c = get_cpu_slab(s, smp_processor_id());
> -	if (likely(page == c->page && !SlabDebug(page))) {
> +	if (likely(page == c->page && c->node >= 0)) {
>  		object[c->offset] = c->freelist;
>  		c->freelist = object;
>  	} else
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-23 17:09    [from the cache]
©2003-2008