From be6f099a0282f5de8451bf93cd27912cdb328d3c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 2 Jun 2009 14:30:12 -0700 Subject: [PATCH] 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. --- lib/timeval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2