qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yangming via <qemu-devel@nongnu.org>
To: "mst@redhat.com" <mst@redhat.com>,
	"david@redhat.com" <david@redhat.com>,
	 "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "wangzhigang (O)" <wangzhigang17@huawei.com>,
	"zhangliang (AG)" <zhangliang5@huawei.com>,
	xiqi <xiqi2@huawei.com>
Subject: Optimization for the virtio-balloon feature on the ARM platform
Date: Mon, 20 Feb 2023 01:33:34 +0000	[thread overview]
Message-ID: <0a0e1f05073d44a38a35e270ca735819@huawei.com> (raw)
In-Reply-To: <8c6d264163574d8b886afdd3e4b77a2d@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

Dear QEMU maintainers,

I am writing to discuss a possible optimization for the virtio-balloon feature on the ARM platform. The 'virtio_balloon_set_config' function is called frequently during the balloon inflation process, and its subfunction 'get_current_ram_size' needs to traverse the virtual machine's memory modules in order to count the current virtual machine's memory (i.e initial ram size + hotplugged memory). This can be very time consuming on the ARM platform, as the ARM virtual machine has much more complex memory modules than the x86 virtual machine.

Therefore, I suggest introducing a global variable, 'total_ram_size', that would be updated only when the balloon is initialized and hotplug memory has completed. This would increase the efficiency of balloon inflation by more than 60% on the ARM platform.

The following code is part of the optimization for balloon:

--- a/qemu/hw/virtio/virtio-balloon.c
+++ b/qemu/hw/virtio/virtio-balloon.c
static void virtio_balloon_set_config(...)
...
-    ram_addr_t vm_ram_size = get_current_ram_size();
+   ram_addr_t vm_ram_size = total_ram_size;
...
I hope this suggestion could be considered or discussed by QEMU developers. I would love to seeing this improvement added to QEMU in the future.

Best regards,
Qi

[-- Attachment #2: Type: text/html, Size: 5466 bytes --]

       reply	other threads:[~2023-02-20  1:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8c6d264163574d8b886afdd3e4b77a2d@huawei.com>
2023-02-20  1:33 ` Yangming via [this message]
2023-02-20  9:15   ` Optimization for the virtio-balloon feature on the ARM platform David Hildenbrand
2023-02-20 12:11     ` Michael S. Tsirkin

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=0a0e1f05073d44a38a35e270ca735819@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=david@redhat.com \
    --cc=mst@redhat.com \
    --cc=wangzhigang17@huawei.com \
    --cc=xiqi2@huawei.com \
    --cc=yangming73@huawei.com \
    --cc=zhangliang5@huawei.com \
    /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).