From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19DD9C05027 for ; Mon, 20 Feb 2023 01:34:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTv3z-0001XD-8T; Sun, 19 Feb 2023 20:33:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTv3x-0001Ww-Up for qemu-devel@nongnu.org; Sun, 19 Feb 2023 20:33:53 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTv3u-0007lZ-Js for qemu-devel@nongnu.org; Sun, 19 Feb 2023 20:33:53 -0500 Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PKlHb3r85znWDT; Mon, 20 Feb 2023 09:31:07 +0800 (CST) Received: from dggpemm500010.china.huawei.com (7.185.36.134) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Mon, 20 Feb 2023 09:33:34 +0800 Received: from dggpemm500010.china.huawei.com ([7.185.36.134]) by dggpemm500010.china.huawei.com ([7.185.36.134]) with mapi id 15.01.2507.017; Mon, 20 Feb 2023 09:33:34 +0800 To: "mst@redhat.com" , "david@redhat.com" , "qemu-devel@nongnu.org" CC: "wangzhigang (O)" , "zhangliang (AG)" , xiqi Subject: Optimization for the virtio-balloon feature on the ARM platform Thread-Topic: Optimization for the virtio-balloon feature on the ARM platform Thread-Index: AdlEyiq0ho6dn5EQSS65n1CEKd/bMgAALcjg Date: Mon, 20 Feb 2023 01:33:34 +0000 Message-ID: <0a0e1f05073d44a38a35e270ca735819@huawei.com> References: <8c6d264163574d8b886afdd3e4b77a2d@huawei.com> In-Reply-To: <8c6d264163574d8b886afdd3e4b77a2d@huawei.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.174.184.140] Content-Type: multipart/alternative; boundary="_000_0a0e1f05073d44a38a35e270ca735819huaweicom_" MIME-Version: 1.0 X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.187; envelope-from=yangming73@huawei.com; helo=szxga01-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Yangming From: Yangming via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --_000_0a0e1f05073d44a38a35e270ca735819huaweicom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Dear QEMU maintainers, I am writing to discuss a possible optimization for the virtio-balloon feat= ure 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 x8= 6 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 ha= s completed. This would increase the efficiency of balloon inflation by mor= e 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 =3D get_current_ram_size(); + ram_addr_t vm_ram_size =3D 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 --_000_0a0e1f05073d44a38a35e270ca735819huaweicom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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&= #8217; 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 th= e current virtual machine's memory (i.e initial ram size + hotplugged m= emory). 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, ‘tot= al_ram_size’, that would be updated only when the balloon is initiali= zed 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 =3D get_current_ram= _size();

+   ram_addr_t vm_ram_size =3D total_ram_size;

I hope this suggestion could be considered or discussed by QEM= U developers. I would love to seeing this improvement added to QEMU in the = future.

 

Best regards,

Qi<= o:p>

--_000_0a0e1f05073d44a38a35e270ca735819huaweicom_--