public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Venkatesh Pallipadi <venki@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Ranjit Manomohan <ranjitm@google.com>
Subject: [PATCH] Re: [PATCH] sched: Buggy comparison in check_preempt_tick
Date: Wed, 05 Jan 2011 05:41:17 +0100	[thread overview]
Message-ID: <1294202477.9384.5.camel@marge.simson.net> (raw)
In-Reply-To: <1293515293.6930.11.camel@marge.simson.net>

Going through my mailbox, I see this remains unaddressed.  I chose the
keep it option, but whack it and revisit later is also viable.

On Tue, 2010-12-28 at 06:48 +0100, Mike Galbraith wrote:
> On Sun, 2010-12-26 at 08:23 +0100, Mike Galbraith wrote:
> 
> > But anyway..
> > 
> > echo NO_WAKEUP_PREEMPT > sched_features
> > echo NO_TESTME > sched_features
> > two hogs running on isolcpu 3, pid 6890 at nice -2
> > 
> > while sleep 1; do  grep 'pert.*6890' /proc/sched_debug; done
> > 
> > runnable tasks:
> >             task   PID         tree-key  switches  prio
> > -------------------------------------------------------
> > R           pert  6890     50201.071851      7453   118
> > R           pert  6890     50596.171290      7513   118  +60
> > R           pert  6890     50991.265264      7572   118  +59
> > R           pert  6890     51383.781965      7631   118  +59
> >             pert  6890     51781.463129      7691   118  +60
> > 
> > echo TESTME > sched_features
> >             pert  6890    126881.306733     18977   118
> > R           pert  6890    127273.825719     19036   118  +59
> > R           pert  6890    127668.928218     19095   118  +59
> > R           pert  6890    128064.031372     19154   118  +59
> > R           pert  6890    128459.134339     19213   118  +59
> > 
> > ...with a compute load, the thing should be a noop, and appears to be so
> > (with busted compare fixed anyway;).  You have to be well overloaded for
> > buddies to kick in these days, so it's probably pretty hard to get
> > enough spread for the thing to fire.
> 
> I did a bit more testing yesterday with wakeup loads.  There's enough
> spread for the test to nudge things a few [0..4] times per second/core.
> 
> I'd either fix the comparison, and let it keep on nudging once in a
> while, or whack the whole thing.

sched: fix signed unsigned comparison in check_preempt_tick()

signed unsigned comparison may lead to superfluous resched if leftmost
is right of the current task, wasting a few cycles, and inadvertently
_lengthening_ the current task's slice.  

Reported-by: Venkatesh Pallipadi <venki@google.com>
Signed-off-by: Mike Galbraith <efault@gmx.de>

---
 kernel/sched_fair.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.37.git/kernel/sched_fair.c
===================================================================
--- linux-2.6.37.git.orig/kernel/sched_fair.c
+++ linux-2.6.37.git/kernel/sched_fair.c
@@ -872,7 +872,7 @@ check_preempt_tick(struct cfs_rq *cfs_rq
 		struct sched_entity *se = __pick_next_entity(cfs_rq);
 		s64 delta = curr->vruntime - se->vruntime;
 
-		if (delta > ideal_runtime)
+		if (delta > (s64)ideal_runtime)
 			resched_task(rq_of(cfs_rq)->curr);
 	}
 }



  reply	other threads:[~2011-01-05  4:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-25  0:26 [PATCH] sched: Buggy comparison in check_preempt_tick Venkatesh Pallipadi
2010-12-25  7:50 ` Mike Galbraith
2010-12-26  0:05   ` Venkatesh Pallipadi
2010-12-26  7:23     ` Mike Galbraith
2010-12-28  5:48       ` Mike Galbraith
2011-01-05  4:41         ` Mike Galbraith [this message]
2011-01-18 19:06           ` [tip:sched/urgent] sched: Fix signed unsigned comparison in check_preempt_tick() tip-bot for Mike Galbraith

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=1294202477.9384.5.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=ranjitm@google.com \
    --cc=venki@google.com \
    /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