]> git.proxmox.com Git - mirror_qemu.git/commitdiff
qemu-timer: Skip empty timer lists before locking in qemu_clock_deadline_ns_all
authorIdan Horowitz <idan.horowitz@gmail.com>
Fri, 14 Jan 2022 00:43:58 +0000 (02:43 +0200)
committerRichard Henderson <richard.henderson@linaro.org>
Tue, 21 Jun 2022 16:24:34 +0000 (09:24 -0700)
This decreases qemu_clock_deadline_ns_all's share from 23.2% to 13% in a
profile of icount-enabled aarch64-softmmu.

Signed-off-by: Idan Horowitz <idan.horowitz@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220114004358.299534-2-idan.horowitz@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
util/qemu-timer.c

index a670a57881841934d40e74a58d442a4512990ed9..6a0de33dd2b86c339dc9dc5abe6548e44c918cb4 100644 (file)
@@ -261,6 +261,9 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
     }
 
     QLIST_FOREACH(timer_list, &clock->timerlists, list) {
+        if (!qatomic_read(&timer_list->active_timers)) {
+            continue;
+        }
         qemu_mutex_lock(&timer_list->active_timers_lock);
         ts = timer_list->active_timers;
         /* Skip all external timers */