patch 5/6
This patch tightens timeslice accounting the rest of the way, such that
a task which has received more than it's slice due to missing with the
timer interrupt will have the excess deducted from their next slice.
signed-off-by: Mike Galbraith <[email protected]>
--- linux-2.6.16-mm1/kernel/sched.c-4.throttle 2006-03-24 09:36:08.000000000 +0100
+++ linux-2.6.16-mm1/kernel/sched.c 2006-03-24 09:40:33.000000000 +0100
@@ -2924,13 +2924,28 @@
unsigned int slice = last_slice(p);
unsigned int slice_avg, cpu, idle;
long run_time = -1 * p->slice_time_ns;
+ long slice_time_ns = task_timeslice_ns(p);
int w = MAX_BONUS, delta, bonus;
/*
- * Update time_slice.
+ * Update time_slice. Account for unused fragment,
+ * or excess time received due to missed tick.
*/
- p->slice_time_ns = task_timeslice_ns(p);
- p->time_slice = task_timeslice(p);
+ p->slice_time_ns += slice_time_ns;
+ /*
+ * Not common, but this does happen on SMP systems.
+ * Timeslice theft of this magnitude has never been
+ * observed in the wild, so assume that this is BS,
+ * and give the poor task it's full slice. Theory:
+ * mostly idle task migrates between CPUs numerous
+ * times during it's slice, timestamp rounding leads
+ * to wildly inaccurate calculation. Rounding has
+ * maximum effect on those who stretch their slice,
+ * but is also fairly meaningless, so ignore it.
+ */
+ if (unlikely(p->slice_time_ns < NS_TICK))
+ p->slice_time_ns = slice_time_ns;
+ p->time_slice = NS_TO_JIFFIES(p->slice_time_ns);
set_last_slice(p, p->time_slice);
/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]