Re: [PATCH] virtual sched_clock() for s390

From: Jeremy Fitzhardinge
Date: Thu Jul 19 2007 - 11:30:25 EST


Jan Glauber wrote:
> This patch introduces a cpu time clock for s390 (only ticking
> if the virtual cpu is running) and bases the s390 implementation
> of sched_clock() on it.
>
> The times lice length on a virtual cpu can be anything
> between the calculated time slice and zero. In reality
> this doesn't seem to be problem, since the scheduler is fair
> enough to not let a single process starve but the current
> implementation can lead to inefficient short time slices.
>
> By providing a 'virtual' sched_clock() we guarantee that a
> process can get its time slice regardless of scheduling
> decisions from the hypervisor.
>
> Patch applies to 2.6.22 git and works fine with CFS.
>

The Xen sched_clock implementation is very similar, and it seems to work
well.

> /*
> - * Monotonic_clock - returns # of nanoseconds passed since time_init()
> + * Scheduler clock - returns current time in nanosec units.
> + * Now based on virtual cpu time to only account time the guest
> + * was actually running.
>

Runn*ing*? Does it include time the VCPU spends idle/blocked? If not,
then the scheduler won't be able to tell how long a process has been
asleep. Maybe this doesn't matter (I had this problem in a version of
Xen's sched_clock, and I can't say I saw an ill effects from it).

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/