@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; /* -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list