Re: [PATCH] dyn-tick3 tweaks

Nick Piggin
2005-08-05T00:53:18Z

Con Kolivas wrote:

> Something like this on top is cleaner and quieter. I'll add this to pending
> changes for another version.
>
>
> ------------------------------------------------------------------------
>
> Index: linux-2.6.13-rc5-ck2/arch/i386/kernel/timers/timer_tsc.c
> ===================================================================
> --- linux-2.6.13-rc5-ck2.orig/arch/i386/kernel/timers/timer_tsc.c 2005-08-03 11:29:29.000000000 +1000
> +++ linux-2.6.13-rc5-ck2/arch/i386/kernel/timers/timer_tsc.c 2005-08-05 10:22:25.000000000 +1000
> @@ -167,10 +167,20 @@ static void delay_tsc(unsigned long loop
> } while ((now-bclock) < loops);
> }
>
> +/* update the monotonic base value */
> +static inline void update_monotonic_base(unsigned long long last_offset)
> +{
> + unsigned long long this_offset;
> +
> + this_offset = ((unsigned long long)last_tsc_high << 32) | last_tsc_low;
> + monotonic_base += cycles_2_ns(this_offset - last_offset);
> + write_sequnlock(&monotonic_lock);
> +}
> +

All else being equal, it is much better if you unlock in the
same function that takes the lock. For readability.

It looks like you should be able to leave all the flow control
and locking the same, and use update_monotonic_base() to
do the actual update?

--
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com