lkml.org 
[lkml]   [2006]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] cpuset memory spread slab cache optimizations
Paul Jackson <pj@sgi.com> wrote:
>
> @@ -2703,20 +2704,9 @@ static inline void *____cache_alloc(stru
> struct array_cache *ac;
>
> #ifdef CONFIG_NUMA
> - if (unlikely(current->mempolicy && !in_interrupt())) {
> - int nid = slab_node(current->mempolicy);
> -
> - if (nid != numa_node_id())
> - return __cache_alloc_node(cachep, flags, nid);
> - }
> - if (unlikely(cpuset_mem_spread_check() &&
> - (cachep->flags & SLAB_MEM_SPREAD) &&
> - !in_interrupt())) {
> - int nid = cpuset_mem_spread_node();
> -
> - if (nid != numa_node_id())
> - return __cache_alloc_node(cachep, flags, nid);
> - }
> + if (unlikely(current->flags & (PF_MEM_SPREAD|PF_MEMPOLICY)))
> + if ((objp = alternate_node_alloc(cachep, flags)) != NULL)
> + return objp;
> #endif
>
> check_irq_off();
> @@ -2751,6 +2741,25 @@ __cache_alloc(struct kmem_cache *cachep,
>
> #ifdef CONFIG_NUMA
> /*
> + * Try allocating on another node if PF_MEM_SPREAD or PF_MEMPOLICY.
> + */
> +static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags)
> +{
> + int nid_alloc, nid_here;
> +
> + if (in_interrupt())
> + return NULL;
> + nid_alloc = nid_here = numa_node_id();
> + if (cpuset_mem_spread_check() && (cachep->flags & SLAB_MEM_SPREAD))
> + nid_alloc = cpuset_mem_spread_node();
> + else if (current->mempolicy)
> + nid_alloc = slab_node(current->mempolicy);
> + if (nid_alloc != nid_here)
> + return __cache_alloc_node(cachep, flags, nid_alloc);
> + return NULL;
> +}
> +

Why not move the PF_MEM_SPREAD|PF_MEMPOLICY test into
alternate_node_alloc(), inline the whole thing and nuke the #ifdef in
__cache_alloc()?

We're adding even more goop into the NUMA __cache_alloc() fastpath. This bad.
-
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: 2006-02-05 00:54    [W:0.133 / U:1.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site