All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: bug in sched.c:task_hot()
Date: Tue, 05 Oct 2004 13:17:55 +1000	[thread overview]
Message-ID: <41621263.2000404@yahoo.com.au> (raw)
In-Reply-To: <200410050237.i952bx620740@unix-os.sc.intel.com>

Chen, Kenneth W wrote:

>Current implementation of task_hot() has a performance bug in it
>that it will cause integer underflow.
>
>Variable "now" (typically passed in as rq->timestamp_last_tick)
>and p->timestamp are all defined as unsigned long long.  However,
>If former is smaller than the latter, integer under flow occurs
>which make the result of subtraction a huge positive number. Then
>it is compared to sd->cache_hot_time and it will wrongly identify
>a cache hot task as cache cold.
>
>This bug causes large amount of incorrect process migration across
>cpus (at stunning 10,000 per second) and we lost cache affinity very
>quickly and almost took double digit performance regression on a db
>transaction processing workload.  Patch to fix the bug.  Diff'ed against
>2.6.9-rc3.
>
>Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
>

This one looks OK (the other may need a bit of rethinking).
What kernel is the regression in relation to, out of interest?

>
>--- linux-2.6.9-rc3/kernel/sched.c.orig	2004-10-04 19:11:21.000000000 -0700
>+++ linux-2.6.9-rc3/kernel/sched.c	2004-10-04 19:19:27.000000000 -0700
>@@ -180,7 +180,8 @@ static unsigned int task_timeslice(task_
> 	else
> 		return SCALE_PRIO(DEF_TIMESLICE, p->static_prio);
> }
>-#define task_hot(p, now, sd) ((now) - (p)->timestamp < (sd)->cache_hot_time)
>+#define task_hot(p, now, sd) ((long long) ((now) - (p)->timestamp)	\
>+				< (long long) (sd)->cache_hot_time)
>
> enum idle_type
> {
>
>
>-
>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/
>
>


  reply	other threads:[~2004-10-05  3:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-05  2:38 bug in sched.c:task_hot() Chen, Kenneth W
2004-10-05  3:17 ` Nick Piggin [this message]
2004-10-05 17:15   ` Chen, Kenneth W
2004-10-05  7:33 ` Peter Williams
2004-10-05  7:44   ` Nick Piggin
2004-10-05  8:07     ` Peter Williams
2004-10-05  8:42       ` Nick Piggin
2004-10-05 10:03         ` Peter Williams
2004-10-05 17:39   ` Chen, Kenneth W
2004-10-05 22:09     ` Peter Williams
2004-10-05  8:03 ` Ingo Molnar

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=41621263.2000404@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.