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

Re: [libvirt] [PATCH 1/3] Memory: Use consistent type for all memory elements.



On 05.11.2014 11:58, Prerna Saxena wrote:

From 4b3e336ea045759758b04440d75802e990506e2b Mon Sep 17 00:00:00 2001
From: Prerna Saxena <prerna linux vnet ibm com>
Date: Fri, 31 Oct 2014 16:07:21 +0530

Domain memory elements such as max_balloon and cur_balloon are
implemented as 'unsigned long long', whereas the 'memory' element
in NUMA cells is implemented as 'unsigned int'.

Use the same data type (unsigned long long) for 'memory' element
in NUMA cells.

Signed-off-by: Prerna Saxena <prerna linux vnet ibm com>
---
  src/conf/cpu_conf.c     | 4 ++--
  src/conf/cpu_conf.h     | 2 +-
  src/qemu/qemu_command.c | 6 +++---
  3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 9b7fbb0..5475c07 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -496,7 +496,7 @@ virCPUDefParseXML(xmlNodePtr node,
                  goto error;
              }

-            ret = virStrToLong_ui(memory, NULL, 10, &def->cells[cur_cell].mem);
+            ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem);
              if (ret == -1) {
                  virReportError(VIR_ERR_XML_ERROR, "%s",
                                 _("Invalid 'memory' attribute in NUMA cell"));
@@ -702,7 +702,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
              virBufferAddLit(buf, "<cell");
              virBufferAsprintf(buf, " id='%zu'", i);
              virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
-            virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem);
+            virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem);
              if (memAccess)
                  virBufferAsprintf(buf, " memAccess='%s'",
                                    virMemAccessTypeToString(memAccess));
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index d45210b..5bcf101 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -105,7 +105,7 @@ typedef virCellDef *virCellDefPtr;
  struct _virCellDef {
      virBitmapPtr cpumask; /* CPUs that are part of this node */
      char *cpustr;         /* CPUs stored in string form for dumpxml */
-    unsigned int mem;     /* Node memory in kB */
+    unsigned long long mem;     /* Node memory in kB */
      virMemAccess memAccess;
  };

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 917639e..13b54dd 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6693,7 +6693,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
      }

      for (i = 0; i < def->cpu->ncells; i++) {
-        int cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024);
+        unsigned long long cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024);
          def->cpu->cells[i].mem = cellmem * 1024;
          virMemAccess memAccess = def->cpu->cells[i].memAccess;

@@ -6799,7 +6799,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
                  virBufferAddLit(&buf, "memory-backend-ram");
              }

-            virBufferAsprintf(&buf, ",size=%dM,id=ram-node%zu", cellmem, i);
+            virBufferAsprintf(&buf, ",size=%lluM,id=ram-node%zu", cellmem, i);

              if (virDomainNumatuneMaybeFormatNodeset(def->numatune, nodeset,
                                                      &nodemask, i) < 0)
@@ -6849,7 +6849,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
              virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
              virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
          } else {
-            virBufferAsprintf(&buf, ",mem=%d", cellmem);
+            virBufferAsprintf(&buf, ",mem=%llu", cellmem);
          }

          virCommandAddArgBuffer(cmd, &buf);


ACKed & pushed as this doesn't depend on the rest of the patches.

Michal


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