Xserver and Gettimeofday

Lukas Hejtmanek xhejtman at ics.muni.cz
Wed Aug 29 02:15:33 PDT 2007


On Wed, Aug 29, 2007 at 11:08:40AM +0200, Xavier Bestel wrote:
> > In OLS 2006, Dave Jones (in his famous talk about why user-space sucks)
> > complained about X calling gettimeofday too often (and gettimeofday
> > being expensive). Things like mmap'ing /dev/rtc were proposed but didn't
> > get merged in Linux in the end. There's a new timerfd syscall in 2.6.22
> > which enables blocking on a file descriptor until a timer expires, I
> > don't know whether it could help for your problem.
> 
> Keith said that the X scheduler consumes gettimeofday() calls to ensure
> tasks don't run for more than 20ms. As this kind of time measurement
> doesn't seem to require high precision, maybe simply using the TSC (when
> available) is enough ?

depending on what is the gettimeofday() used for, we may switch to TSC (even
if TSC is not reliable due to frequency scaling), it can be obviously done in
case of timeouts. 

On the other hand, it just means that particular busy loop will just iterate
faster in userspace. The point is that all busy loops in drivers should be
avoided pro waits on IRQ.

-- 
Lukáš Hejtmánek



More information about the xorg mailing list