Re: [PATCH] linux-2.5.44_vsyscall_A1

Jeff Garzik (jgarzik@pobox.com)
Tue, 22 Oct 2002 22:03:15 -0400


john stultz wrote:
> All,
> Here is the next rev of the i386 vsyscall gettimeofday port I sent
> earlier. I've added a fix for the linker trouble in the last one, as
> well as wrapped the whole thing in CONFIG_VSYSCALL.
>
> This patch implements gettimeofday in a user readable page, allowing
> for calls to gettimeofday to execute completely in userspace, giving a
> significant performance boost.
>
> Changes to glibc are unnecessary, because users that want to use the
> vsyscall can do so by LD_PRELOADING a library which alias gettimeofday
> before executing their application. This will not affect any other
> application and allows the backward compatibility issue to be ignored.
> I've created an example library (to be attached in a following email)
> and ran a quick performance test w/ and w/o the preloaded library,
> giving the following results:
>
> Normal gettimeofday
> gettimeofday ( 1403307us / 1000000runs ) = 1.403306us
> vsyscall LD_PRELOAD gettimeofday
> gettimeofday ( 285423us / 1000000runs ) = 0.285423us
>
> Since this code uses the TSC for calculating time of day, this patch
> will not help systems that suffer from TSC skew (ie: many NUMA systems,
> etc). However, for UP and SMP boxes this is a pretty major win.
> Alternative methods to use the cyclone/HPET registers for NUMA boxes are
> also feasible in the future.
>
> Please let me know your thoughts about 2.5 integration.

In terms of implementation, I think it's way too x86-specific... some
of the vsyscall infrastructure can be more generic, making it easier for
other arches to implement the same functionality. Also use of TSC isn't
a terribly good idea...

Overall the idea has existed for a while, and I think it's a good one...
gettimeofday(2) is very definitely a performance bottleneck in
databases, in apache [if nothing's changed in that area...], etc.

Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/