public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Tim Blechmann <tim@klingt.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] sched: Optimize branch hint in context_switch()
Date: Sun, 29 Nov 2009 17:12:37 +0200	[thread overview]
Message-ID: <4B128F65.40804@redhat.com> (raw)
In-Reply-To: <4B1262AC.8000903@klingt.org>

On 11/29/2009 02:01 PM, Tim Blechmann wrote:
> Branch hint profiling on my nehalem machine showed 88%
> incorrect branch hints:
>
> 42017484 326957902  88 context_switch                 sched.c              3043
> 42038493 326953687  88 context_switch                 sched.c              3050
>
> @@ -3040,14 +3040,14 @@ context_switch(struct rq *rq, struct task_struct *prev,
>   	 */
>   	arch_start_context_switch(prev);
>
> -	if (likely(!mm)) {
> +	if (unlikely(!mm)) {
>   		next->active_mm = oldmm;
>   		atomic_inc(&oldmm->mm_count);
>   		enter_lazy_tlb(oldmm, next);
>   	} else
>   		switch_mm(oldmm, mm, next);
>
> -	if (likely(!prev->mm)) {
> +	if (unlikely(!prev->mm)) {
>   		prev->active_mm = NULL;
>   		rq->prev_mm = oldmm;
>   	}
>    

I don't think either the original or the patch is correct.  Whether or 
not a task has an mm is entirely workload dependent, we shouldn't be 
giving hints here.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2009-11-29 15:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-29 12:01 [PATCH] sched: Optimize branch hint in context_switch() Tim Blechmann
2009-11-29 15:12 ` Avi Kivity [this message]
2009-11-29 15:20   ` Peter Zijlstra
2009-11-29 15:25     ` Avi Kivity
2009-11-29 16:02       ` Tim Blechmann
2009-11-30  9:25       ` Christian Borntraeger

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=4B128F65.40804@redhat.com \
    --to=avi@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.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