[PATCH 2/3] qemu: do not fill in default pagesize in qemuGetDomainHupageMemPath

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

 



Commit 6864d8f740e2502dc7625bdf18ffde4465b14f69 moved this one level up
for qemuBuildMemoryBackendProps but left qemuBuildMemPathStr intact.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/qemu/qemu_command.c |  8 +++++---
 src/qemu/qemu_conf.c    | 35 +++++++++++++----------------------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index aaca75900b..79b9a5d4f9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7847,9 +7847,11 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
      * if user requested file allocation. */
     if (def->mem.nhugepages &&
         def->mem.hugepages[0].size != system_page_size) {
-        if (qemuGetDomainHupageMemPath(def, cfg,
-                                       def->mem.hugepages[0].size,
-                                       &mem_path) < 0)
+        unsigned long long pagesize = def->mem.hugepages[0].size;
+        if (!pagesize &&
+            qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
+            return -1;
+        if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &mem_path) < 0)
             return -1;
     } else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
         if (qemuGetMemoryBackingPath(def, cfg, "ram", &mem_path) < 0)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 41ce0a978d..4bec885c6b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1926,8 +1926,6 @@ qemuGetDomainDefaultHugepath(const virDomainDef *def,
 /**
  * qemuGetDomainHupageMemPath: Construct HP enabled memory backend path
  *
- * If no specific hugepage size is requested (@pagesize is zero)
- * the default hugepage size is used).
  * The resulting path is stored at @memPath.
  *
  * Returns 0 on success,
@@ -1948,29 +1946,22 @@ qemuGetDomainHupageMemPath(const virDomainDef *def,
         return -1;
     }
 
-    if (!pagesize) {
-        if (!(*memPath = qemuGetDomainDefaultHugepath(def,
-                                                      cfg->hugetlbfs,
-                                                      cfg->nhugetlbfs)))
-            return -1;
-    } else {
-        for (i = 0; i < cfg->nhugetlbfs; i++) {
-            if (cfg->hugetlbfs[i].size == pagesize)
-                break;
-        }
-
-        if (i == cfg->nhugetlbfs) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Unable to find any usable hugetlbfs "
-                             "mount for %llu KiB"),
-                           pagesize);
-            return -1;
-        }
+    for (i = 0; i < cfg->nhugetlbfs; i++) {
+        if (cfg->hugetlbfs[i].size == pagesize)
+            break;
+    }
 
-        if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
-            return -1;
+    if (i == cfg->nhugetlbfs) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Unable to find any usable hugetlbfs "
+                         "mount for %llu KiB"),
+                       pagesize);
+        return -1;
     }
 
+    if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
+        return -1;
+
     return 0;
 }
 
-- 
2.19.2

--
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