Re: [accounting regression since rc1] scheduler updates

Ingo Molnar
2007-08-21T11:25:51Z

* Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> Am Montag, 20. August 2007 schrieb Ingo Molnar:
> > could you send that precise sched_clock() patch? It should be an order
> > of magnitude simpler than the high-precision stime/utime tracking you
> > already do, and it's needed for quality scheduling anyway.
>
> I have a question about that. I just played with sched_clock, and even
> when I intentionally slow down sched_clock by a factor of 2, my cpu
> bound process gets 100 % in top. If this is intentional, I dont
> understand how a virtualized sched_clock would fix the accounting
> change?

could you try the patch below, does it work any better?

Ingo

---
kernel/sched.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -333,6 +333,14 @@ static void __update_rq_clock(struct rq
#ifdef CONFIG_SCHED_DEBUG
WARN_ON_ONCE(cpu_of(rq) != smp_processor_id());
#endif
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING
+ /*
+ * Trust sched_clock on s390:
+ */
+ if (unlikely(delta > rq->clock_max_delta))
+ rq->clock_max_delta = delta;
+ clock += delta;
+#else
/*
* Protect against sched_clock() occasionally going backwards:
*/
@@ -355,6 +363,7 @@ static void __update_rq_clock(struct rq
clock += delta;
}
}
+#endif

rq->prev_clock_raw = now;
rq->clock = clock;