mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Williams <pwil3058@bigpond.net.au>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH, ZAPHOD] Fix load balancing problem due to timestamp
Date: Wed, 06 Oct 2004 08:45:54 +1000	[thread overview]
Message-ID: <41632422.5000208@bigpond.net.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]

Please find attached a patch (against 2.6.9-rc3-mm2) that fixes the load 
balancing problems caused by timestamp being larger than 
timestamp_last_tick.

-- 
Peter Williams                                   pwil3058@bigpond.net.au

"Learning, n. The kind of ignorance distinguishing the studious."
  -- Ambrose Bierce

[-- Attachment #2: loadbalance.patch --]
[-- Type: text/x-patch, Size: 1380 bytes --]

--- linux-2.6.9-rc3-mm2/kernel/sched.c	2004-10-05 15:17:09.000000000 +1000
+++ linux-2.6.9-rc3-mm2-mod/kernel/sched.c	2004-10-06 08:30:26.538386290 +1000
@@ -327,7 +327,7 @@ static inline unsigned int task_timeslic
 	return time_slice_ticks;
 }
 
-#define task_hot(p, sd) ((p)->rq->timestamp_last_tick - (p)->timestamp < (sd)->cache_hot_time)
+#define task_hot(p, sd) ((long long)((p)->rq->timestamp_last_tick - (p)->timestamp) < (long long)(sd)->cache_hot_time)
 
 /*
  * These are the runqueue data structures:
@@ -1196,7 +1196,6 @@ static void activate_task(task_t *p)
 	unsigned long long now = adjusted_sched_clock(p);
 
 	recalc_task_prio(p, now);
-	p->timestamp = now;
 	p->time_slice = task_timeslice(p);
 	p->flags &= ~PF_UISLEEP;
 
@@ -1712,7 +1711,7 @@ void fastcall sched_fork(task_t *p)
 	 * Give the child a new timeslice
 	 */
 	p->time_slice = task_timeslice(p);
-	p->timestamp = sched_clock();
+	p->timestamp = 0;
 	/*
 	 * Initialize the scheduling statistics and bonus counters
 	 */
@@ -4750,10 +4749,7 @@ static void __migrate_task(struct task_s
 		deactivate_task(p);
 		delta_delay_stats(p, adjusted_sched_clock(p));
 		set_task_cpu(p, dest_cpu);
-		/*
-		 *  activate_task() will set the timestamp correctly so there's
-		 *  no need to adjust it here
-		 */
+		adjust_timestamp(p, rq_src);
 		activate_task(p);
 		preempt_curr_if_warranted(p);
 	} else {

                 reply	other threads:[~2004-10-05 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41632422.5000208@bigpond.net.au \
    --to=pwil3058@bigpond.net.au \
    --cc=akpm@osdl.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®