public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Tim Blechmann <tim@klingt.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Christoph Lameter <cl@linux-foundation.org>,
	Nick Piggin <npiggin@suse.de>,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 3/5] slab.c: remove branch hint
Date: Mon, 30 Nov 2009 11:05:06 +0200	[thread overview]
Message-ID: <4B138AC2.7080008@cs.helsinki.fi> (raw)
In-Reply-To: <4B125CC2.7000202@klingt.org>

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

  reply	other threads:[~2009-11-30  9:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1259059549.git.tim@klingt.org>
2009-11-24 10:55 ` [PATCH 1/5] process_64: remove branch hint Tim Blechmann
2009-11-24 16:57   ` [tip:sched/core] sched, x86: Optimize branch hint in __switch_to() tip-bot for Tim Blechmann
2009-11-24 17:28     ` Brian Gerst
2009-11-25  9:03       ` Tim Blechmann
2009-11-25 15:53         ` Brian Gerst
2009-11-25 16:16           ` index 780cd92..22db86a 100644 Brian Gerst
2009-11-25 16:17           ` [PATCH] x86, 64-bit: Set data segments to null after switching to 64-bit mode Brian Gerst
2009-11-26  9:56             ` [tip:x86/asm] " tip-bot for Brian Gerst
2009-11-29 11:44             ` [PATCH] " Tim Blechmann
2009-12-02 11:32     ` [PATCH] Revert "sched, x86: Optimize branch hint in __switch_to()" Tim Blechmann
2009-12-02 13:27       ` [tip:sched/core] " tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 2/5] sched.c: change branch hint Tim Blechmann
2009-11-24 16:56   ` [tip:sched/core] sched: Optimize branch hint in context_switch() tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 3/5] slab.c: remove branch hint Tim Blechmann
2009-11-24 11:20   ` Ingo Molnar
2009-11-24 11:28     ` Pekka Enberg
2009-11-24 11:42       ` Ingo Molnar
2009-11-25 10:41         ` Pekka Enberg
2009-11-24 11:45       ` Tim Blechmann
2009-11-29 11:36       ` Tim Blechmann
2009-11-30  9:05         ` Pekka Enberg [this message]
2009-11-30 16:09           ` Christoph Lameter
2009-11-30 17:44             ` Pekka Enberg
2009-11-30 17:50               ` Christoph Lameter
2009-11-30 17:59               ` [PATCH] branch profiling on my nehalem machine showed 99% incorrect branch hints: Tim Blechmann
2009-12-06  8:33                 ` Pekka Enberg
2009-11-24 10:55 ` [PATCH 4/5] sched_fair.c: remove branch hint Tim Blechmann
2009-11-24 16:56   ` [tip:sched/core] sched: Optimize branch hint in pick_next_task_fair() tip-bot for Tim Blechmann
2009-11-24 10:55 ` [PATCH 5/5] workqueue.c: remove branch hint Tim Blechmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B138AC2.7080008@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=cl@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=tim@klingt.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox