From cd758dd0acaaf1f76f9727d4409915f3293db07a Mon Sep 17 00:00:00 2001 From: Alex Bligh Date: Wed, 21 Aug 2013 16:02:44 +0100 Subject: aio / timers: Add prctl(PR_SET_TIMERSLACK, 1, ...) to reduce timer slack Where supported, called prctl(PR_SET_TIMERSLACK, 1, ...) to set one nanosecond timer slack to increase precision of timer calls. Signed-off-by: Alex Bligh Signed-off-by: Stefan Hajnoczi --- qemu-timer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'qemu-timer.c') diff --git a/qemu-timer.c b/qemu-timer.c index 120d58fb2a..74f904b310 100644 --- a/qemu-timer.c +++ b/qemu-timer.c @@ -41,6 +41,10 @@ #include #endif +#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK +#include +#endif + /***********************************************************/ /* timers */ @@ -507,6 +511,9 @@ void init_clocks(void) vm_clock = qemu_clock_new(QEMU_CLOCK_VIRTUAL); host_clock = qemu_clock_new(QEMU_CLOCK_HOST); } +#ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK + prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); +#endif } uint64_t timer_expire_time_ns(QEMUTimer *ts) -- cgit v1.2.3-59-g8ed1b