[PATCH] time: Use CLOCK_REALTIME for time (BZ #30200)

Florian Weimer fweimer@redhat.com
Tue Mar 7 11:51:17 GMT 2023


* Adhemerval Zanella Netto:

>> And of those original 17 ns, quite a bit is overhead from the
>> benchmarking loop.  I guess applications could work around it by having
>> a background timer thread that increments a global variable and use that
>> instead of the time function call, but that seems not a great approach.
>
> Yes, this is expected since time call will be route through clock_gettime.
> Another fix would be to convince kernels developers to use CLOCK_REALTIME
> on vDSO as well.

No, that won't help.  I think the crucial aspect for good x86-64
performance is that by using the time entry point, we tell the kernel
that it does not have to obtain microsecond or millisecond precision.

>> Based on previous feedback, I expect we'd have to carry a downstream
>> revert of this patch indefinitely, so I'm rather strongly against
>> applying it upstrean.
>
> To me it really seems like a over-optimization specially because 'time'
> has only second resolution.

I'm afraid that this will impact logging performance significantly in
some scenarios.

Thanks,
Florian



More information about the Libc-alpha mailing list