From: Ben Pfaff Date: Tue, 2 Jun 2009 21:30:12 +0000 (-0700) Subject: timeval: Refresh current time after every wakeup, not just false wakeups. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be6f099a0282f5de8451bf93cd27912cdb328d3c;p=openvswitch timeval: Refresh current time after every wakeup, not just false wakeups. This failure to update the current time in some cases may have contributed to false complaints about long poll delays, since this could leave up to 100 ms of time blocked in the poll system call accounted to the next inter-poll interval instead of to the poll system call itself. This commit makes vswitch's claimed average poll interval to drop by a large amount, from ~20 ms to ~2 ms. --- diff --git a/lib/timeval.c b/lib/timeval.c index 84384f71..da72d948 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -183,6 +183,7 @@ time_poll(struct pollfd *pollfds, int n_pollfds, int timeout) if (retval < 0) { retval = -errno; } + time_refresh(); if (retval != -EINTR) { break; } @@ -191,7 +192,6 @@ time_poll(struct pollfd *pollfds, int n_pollfds, int timeout) block_sigalrm(&oldsigs); blocked = true; } - time_refresh(); } if (blocked) { unblock_sigalrm(&oldsigs);