qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Idan Horowitz <idan.horowitz@gmail.com>
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org,
	Idan Horowitz <idan.horowitz@gmail.com>,
	pbonzini@redhat.com
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	[thread overview]
Message-ID: <20220114004358.299534-2-idan.horowitz@gmail.com> (raw)
In-Reply-To: <20220114004358.299534-1-idan.horowitz@gmail.com>

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



  reply	other threads:[~2022-01-14  0:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  0:43 [PATCH 1/2] softmmu/cpus: Check if the cpu work list is empty atomically Idan Horowitz
2022-01-14  0:43 ` Idan Horowitz [this message]
2022-01-26 21:43   ` [PATCH 2/2] qemu-timer: Skip empty timer lists before locking in qemu_clock_deadline_ns_all Richard Henderson
2022-06-19  8:54     ` Idan Horowitz
2022-06-21 16:25       ` Richard Henderson
2022-01-26 21:40 ` [PATCH 1/2] softmmu/cpus: Check if the cpu work list is empty atomically Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220114004358.299534-2-idan.horowitz@gmail.com \
    --to=idan.horowitz@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).