Re: [PATCH] x86-64: Add time to vDSO
From: Andrew Lutomirski
Date: Thu May 19 2011 - 10:11:25 EST
On Thu, May 19, 2011 at 9:53 AM, Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
> On Thu, May 19, 2011 at 09:24:48AM -0400, Andy Lutomirski wrote:
>> The only fast implementation of time(2) we expose is through the
>> vsyscall page and we want to get userspace to stop using the
>> vsyscall page. So make it available through the vDSO as well.
>
> User space can just use vgettimeofday() and only take the seconds.
> Adding time() too was a mistake back then.
>
> And BTW just for seconds alone you wouldn't need the seqlock.
True. I just copied this from the vsyscall code. I can optimize it,
but maybe that should be a followup patch. I'd rather not duplicate
code like this, but that would need some additional infrastructure.
Note that this is five times as fast as vgettimeofday on Sandy Bridge
with my patches. Without the patches it's seven times as fast, and on
older machines it's more like 100 times faster. I'm not sure that
having glibc use CLOCK_REALTIME_COARSE is a good idea -- some day we
might want to get rid of the periodic tick even under load and then
time() should do something clever.
--Andy
>
> -Andi
>
--
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/