[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] qemu-timer: Skip empty timer lists before locking in qemu_cl
From: |
Idan Horowitz |
Subject: |
[PATCH 2/2] qemu-timer: Skip empty timer lists before locking in qemu_clock_deadline_ns_all |
Date: |
Fri, 14 Jan 2022 02:43:58 +0200 |
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>
---
util/qemu-timer.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index f36c75e594..e56895ef55 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -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 */
--
2.34.1