netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 3/5] slab.c: remove branch hint
       [not found]       ` <4B125CC2.7000202@klingt.org>
@ 2009-11-30  9:05         ` Pekka Enberg
  2009-11-30 16:09           ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2009-11-30  9:05 UTC (permalink / raw)
  To: Tim Blechmann
  Cc: Ingo Molnar, linux-kernel, Christoph Lameter, Nick Piggin, davem,
	netdev

Tim Blechmann kirjoitti:
> On 11/24/2009 12:28 PM, Pekka Enberg wrote:
>> On Tue, Nov 24, 2009 at 1:20 PM, Ingo Molnar <mingo@elte.hu> wrote:
>>> (Pekka Cc:-ed)
>>>
>>> * Tim Blechmann <tim@klingt.org> wrote:
>>>
>>>> branch profiling on my nehalem machine showed 99% incorrect branch hints:
>>>>
>>>>    28459  7678524  99 __cache_alloc_node             slab.c
>>>>   3551
>>>>
>>>> Signed-off-by: Tim Blechmann <tim@klingt.org>
>>>> ---
>>>>  mm/slab.c |    2 +-
>>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/mm/slab.c b/mm/slab.c
>>>> index f70b326..4125fcd 100644
>>>> --- a/mm/slab.c
>>>> +++ b/mm/slab.c
>>>> @@ -3548,7 +3548,7 @@ __cache_alloc_node(struct kmem_cache *cachep,
>>>> gfp_t flags, int nodeid,
>>>>       slab_irq_save(save_flags, this_cpu);
>>>>       this_node = cpu_to_node(this_cpu);
>>>> -     if (unlikely(nodeid == -1))
>>>> +     if (nodeid == -1)
>>>>               nodeid = this_node;
>>>>       if (unlikely(!cachep->nodelists[nodeid])) {
>> That sounds odd to me. Can you see where the incorrectly predicted
>> calls are coming from? Calling kmem_cache_alloc_node() with node set
>> to -1 most of the time could be a real bug somewhere.
> 
> when dumping the stack for the incorrectly hinted branches, i get the
> attached stack traces...
> 
> hth, tim
> 
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3548,8 +3548,10 @@ __cache_alloc_node(struct kmem_cache *cachep,
> gfp_t flags, int nodeid,
>         slab_irq_save(save_flags, this_cpu);
> 
>         this_node = cpu_to_node(this_cpu);
> -       if (nodeid == -1)
> +       if (nodeid == -1) {
> +               dump_stack();
>                 nodeid = this_node;
> +       }
> 
>         if (unlikely(!cachep->nodelists[nodeid])) {
>                 /* Node not bootstrapped yet */
> 
> 
> 

OK, so it's the generic alloc_skb() function that keeps hitting 
kmem_cache_alloc_node() with "-1". Christoph, are you okay with removing 
the unlikely() annotation from __cache_alloc_node()?

			Pekka

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/5] slab.c: remove branch hint
  2009-11-30  9:05         ` [PATCH 3/5] slab.c: remove branch hint Pekka Enberg
@ 2009-11-30 16:09           ` Christoph Lameter
  2009-11-30 17:44             ` Pekka Enberg
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2009-11-30 16:09 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Tim Blechmann, Ingo Molnar, linux-kernel, Nick Piggin, davem,
	netdev

On Mon, 30 Nov 2009, Pekka Enberg wrote:

> OK, so it's the generic alloc_skb() function that keeps hitting
> kmem_cache_alloc_node() with "-1". Christoph, are you okay with removing the
> unlikely() annotation from __cache_alloc_node()?

Yes. Lets look for other cases in the allocators too.
kmem_cache_alloc_node used to be mainly used for off node allocations but
the network alloc_skb() case shows that this is changing now.

I hope the users of kmem_cache_alloc_node() realize that using -1 is not
equivalent to kmem_cache_alloc(). kmem_cache_alloc follows numa policies
for memory allocations. kmem_cache_alloc_node() does not.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/5] slab.c: remove branch hint
  2009-11-30 16:09           ` Christoph Lameter
@ 2009-11-30 17:44             ` Pekka Enberg
  2009-11-30 17:50               ` Christoph Lameter
  0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2009-11-30 17:44 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Tim Blechmann, Ingo Molnar, linux-kernel, Nick Piggin, davem,
	netdev

On Mon, Nov 30, 2009 at 6:09 PM, Christoph Lameter
<cl@linux-foundation.org> wrote:
> On Mon, 30 Nov 2009, Pekka Enberg wrote:
>
>> OK, so it's the generic alloc_skb() function that keeps hitting
>> kmem_cache_alloc_node() with "-1". Christoph, are you okay with removing the
>> unlikely() annotation from __cache_alloc_node()?
>
> Yes. Lets look for other cases in the allocators too.
> kmem_cache_alloc_node used to be mainly used for off node allocations but
> the network alloc_skb() case shows that this is changing now.

Tim, can you please re-send the patch to me so I can apply it?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/5] slab.c: remove branch hint
  2009-11-30 17:44             ` Pekka Enberg
@ 2009-11-30 17:50               ` Christoph Lameter
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2009-11-30 17:50 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Tim Blechmann, Ingo Molnar, linux-kernel, Nick Piggin, davem,
	netdev

On Mon, 30 Nov 2009, Pekka Enberg wrote:

> Tim, can you please re-send the patch to me so I can apply it?

SLUB has no issue since NUMA decisions are deferred to the page allocator.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-30 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1259059549.git.tim@klingt.org>
     [not found] ` <4B0BBBA8.2090604@klingt.org>
     [not found]   ` <20091124112058.GA23765@elte.hu>
     [not found]     ` <84144f020911240328l3d36d347o6c91b2b1a0f50f2a@mail.gmail.com>
     [not found]       ` <4B125CC2.7000202@klingt.org>
2009-11-30  9:05         ` [PATCH 3/5] slab.c: remove branch hint Pekka Enberg
2009-11-30 16:09           ` Christoph Lameter
2009-11-30 17:44             ` Pekka Enberg
2009-11-30 17:50               ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).