mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH, ZAPHOD] Fix load balancing problem due to timestamp
@ 2004-10-05 22:45 Peter Williams
  0 siblings, 0 replies; only message in thread
From: Peter Williams @ 2004-10-05 22:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel Mailing List

[-- 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 {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-05 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05 22:45 [PATCH, ZAPHOD] Fix load balancing problem due to timestamp Peter Williams

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®