Re: [PATCH 4/9] conf: Replace 'virResctrlAllocIsEmpty' with @n==0 for indicating no resctrl allocation in configuration file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/23/19 11:34 AM, Wang Huaqiang wrote:
@n denotes the number of <cache> element under <cputune/cachetune>
element in function 'virDomainCachetuneDefParse'  or the number of
<node> element under <cputune/memorytune> element in function
virDomainMemorytuneDefParse'.
Originally it is using 'virResctrlAllocIsEmpty' function to judge
if no resctrl allocation defined in <cputune/cachetune> or
<cputune/memorytune> element, this role could be replaced with
checking if @n is zero or not.

This replacement is more efficient and avoiding a long function
calling path.

Signed-off-by: Wang Huaqiang <huaqiang.wang@xxxxxxxxx>
---
  src/conf/domain_conf.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9c95467..dcfd2dd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19360,7 +19360,7 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
/* If no <cache> element or <monitor> element in <cachetune>, do not
       * append any resctrl element */
-    if (!resctrl->nmonitors && virResctrlAllocIsEmpty(alloc)) {
+    if (!resctrl->nmonitors && n == 0) {
          ret = 0;
          goto cleanup;
      }
@@ -19550,7 +19550,7 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
              return -1;
      }
- if (virResctrlAllocIsEmpty(alloc))
+    if (n == 0)
          return 0;
/*


Is this a good idea? virResctrlAllocIsEmpty does more than plain n == 0.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux