xenserver / xe-guest-utilities

XenServer guest utilities for unix-like operating systems
BSD 2-Clause "Simplified" License
56 stars 58 forks source link

CA-382285 Extract Memory Information From MemFree When Kernel Version… #155

Closed LunfanZhang closed 9 months ago

LunfanZhang commented 10 months ago

For current implementation, some guests do not report meminfo_free information. this is because the guest tool only use MemAvailable to obtain memory free information. assuming that all guests will respond with the MemAvailable parameter. However, the fact is that kernels earlier than 3.14 do not provide MemAvailable . Therefore, for guest which still use the ancient version of kernel (e.g. RHEL6), it is better to match MemFree instead to obtain memory free information.

3.14 Kernel commit: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0a

before refine:

# xenstore-ls| grep mem
memory = ""
 memory-offset = "69696"
 meminfo_total = "4038196"

Afte refine:

# xenstore-ls| grep mem
memory = ""
 memory-offset = "69696"
 meminfo_total = "4038196"
 meminfo_free = "3487488"