summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-04-15 15:40:03 +0100
committerAdam Jackson <ajax@redhat.com>2018-04-17 16:30:36 -0400
commitac7a4bf44c68c5f323375974b208d4530fb5b60f (patch)
treecf0fd6372a9f4fccd36faeec6595b9977cfa09d7
parent78b6f940217c127f0f345b7710aa5994c6ded99c (diff)
os/WaitFor: Check timers on every iteration
Currently we only check timer expiry if there are no client fd (or other input) waiting to be serviced. This makes it very easy to starve the timers with long request queues, and so miss critical timestamps. The timer subsystem is just another input waiting to be serviced, so evaluate it on every loop like all the others, at the cost of calling GetTimeInMillis() slightly more frequently. (A more invasive and likely OS specific alternative would be to move the timer wheel to the local equivalent of timerfd, and treat it as an input fd to the event loop exactly equivalent to all the others, and so also serviced on every pass. The trade-off being that the kernel timer wheel is likely more efficiently integrated with epoll, but individual updates to each timer would then require syscalls.) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--os/WaitFor.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/os/WaitFor.c b/os/WaitFor.c
index fa6a99b18..7c7b1d2d4 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -193,10 +193,9 @@ WaitForSomething(Bool are_ready)
are_ready = clients_are_ready();
}
+ timeout = check_timers();
if (are_ready)
timeout = 0;
- else
- timeout = check_timers();
BlockHandler(&timeout);
if (NewOutputPending)