[ovs-dev] [PATCH 2/2] timeval: Recover from failed timer_create() calls.
blp at nicira.com
Fri Oct 5 17:13:49 UTC 2012
On Thu, Oct 04, 2012 at 07:15:43PM -0700, Ethan Jackson wrote:
> The timer_create() system call is not supported in ESX and returns
> an error when called. Aborting when this system call fails seems a
> bit extreme. So instead, this patch simply falls back to disabling
> the cached time optimization.
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
There are a couple of uses of CACHE_TIME outside timeval.c, in the
unit tests. It would be better, I think, if we exported the correct
runtime value. So I would suggest that we move CACHE_TIME into
timeval.c and add a time_cached() or similar function.
The comment on cache_time is kind of hard to understand. I'd make it
more explicit, e.g.:
True on systems (particularly Linux on x86-64) where clock_gettime()
is cheap. On these systems, we don't bother caching the current time
but check it on every call to e.g. time_msec().
False on systems where clock_gettime() is relatively expensive. On
these systems we cache the current time and set up a periodic SIGALRM
to remind us to check it again.
Also false on systems (e.g. ESX) that don't support setting up timers
based on a monotonically increasing clock.
More information about the dev