The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7729
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This change applies the same change as 375ce45456e9f0789a48541704014a1695896a0f To the per NUMA node total memory calculation. Signed-off-by: Nicolas Bock <nicolas.b...@canonical.com>
From 15f68f5fa43cec52cac8a2b62dde712bee621402 Mon Sep 17 00:00:00 2001 From: Nicolas Bock <nicolas.b...@canonical.com> Date: Wed, 5 Aug 2020 15:07:58 -0600 Subject: [PATCH] Fix total memory for per NUMA node This change applies the same change as 375ce45456e9f0789a48541704014a1695896a0f To the per NUMA node total memory calculation. Signed-off-by: Nicolas Bock <nicolas.b...@canonical.com> --- lxd/resources/memory.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lxd/resources/memory.go b/lxd/resources/memory.go index b948f39e3b..aa554d6096 100644 --- a/lxd/resources/memory.go +++ b/lxd/resources/memory.go @@ -135,8 +135,8 @@ func parseMeminfo(path string) (*meminfo, error) { return &memory, nil } -func getTotalMemory() uint64 { - memoryBlockSizePath := filepath.Join(sysDevicesSystemMemory, "block_size_bytes") +func getTotalMemory(sysDevicesBase) uint64 { + memoryBlockSizePath := filepath.Join(sysDevicesBase, "block_size_bytes") if !sysfsExists(memoryBlockSizePath) { return 0 @@ -201,7 +201,7 @@ func GetMemory() (*api.ResourcesMemory, error) { // Calculate the total memory from /sys/devices/system/memory, as the previously determined // value reports the amount of available system memory minus the amount reserved for the kernel. // If successful, replace the previous value, retrieved from /proc/meminfo. - memTotal := getTotalMemory() + memTotal := getTotalMemory(sysDevicesSystemMemory) if memTotal > 0 { info.Total = memTotal } @@ -256,6 +256,14 @@ func GetMemory() (*api.ResourcesMemory, error) { node.Used = info.Used node.Total = info.Total + // Calculate the total memory from /sys/devices/system/node/memory, as the previously determined + // value reports the amount of available system memory minus the amount reserved for the kernel. + // If successful, replace the previous value, retrieved from /sys/devices/system/node/meminfo. + memTotal := getTotalMemory(entryPath) + if memTotal > 0 { + node.Total = memTotal + } + memory.Nodes = append(memory.Nodes, node) } }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel