On Fri, 5 Aug 2005 10:53 am, Nick Piggin wrote: > 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?
Good advice, thanks. Will respin. Cheers, Con - 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/