Re: [PATCH, RFC] use hrtimer in sched_clock
From: Thomas Gleixner
Date: Mon Jul 14 2008 - 06:04:07 EST
On Mon, 14 Jul 2008, Uwe Kleine-König wrote:
> > > I tested the patch on arch-arm/mach-ns9xxx and it seem seams to work.
> > > But I admit I didn't test it deeply and I didn't measure if there is any
> > > overhead.
> >
> > There is lots of overhead and your approach is simply wrong.
> I expected to have some overhead, but can you please elaborate on
> "simply wrong"?
It's wrong because it has a locking problem vs. xtime lock. Try
printk() in a code region which has xtime_lock write locked.
> > If you do a grep -r sched_clock arch/arm you'll find a couple of
> > examples how to override sched_clock().
> I new that and my purpose was to make this unneeded. Would be nice,
> wouldn't it?
It would be nice, but it's simply not possible as each hardware
platform has a different hardware which is used for that. Also your
approach enforces that the hardware which is used for sched_clock is
the same as the one which is used for timekeeping. That's not
necessarily a good idea as we can use a less accurate and less
reliable hardware for sched_clock() than for timekeeping and we want
to do that when the sched_clock() hardware is faster to access.
Thanks,
tglx