On 31.01.21 00:21, Chris Murphy wrote:
On Sat, Jan 30, 2021 at 11:48 AM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
Bug 1921923 - Kernel under-reporting or hiding about a third of
available memory in "debug" 5.11 series
https://bugzilla.redhat.com/show_bug.cgi?id=1921923
Looks like it's newy enabled CONFIG_KASAN options. The issue doesn't
happen when these are disabled:
-CONFIG_KASAN_SHADOW_OFFSET=0xdffffc0000000000
-CONFIG_KASAN=y
-CONFIG_KASAN_GENERIC=y
-CONFIG_KASAN_INLINE=y
-CONFIG_KASAN_STACK=1
-CONFIG_KASAN_VMALLOC=y
https://static.lwn.net/kerneldoc/dev-tools/kasan.html
"The state of each 8 aligned bytes of memory is encoded in one shadow
byte." - Memory overhead of 1/8, which matches what you report.
As that memory is allocated early during boot, it's never managed by the
buddy and therefore not accounted towards MemTotal.
One could adjust MemTotal accounting in the kernel using
adjust_managed_pages() from kasan code, but why should we really bother
about fixing up accounting for debug kernels.
This debug option comes with a big price tag on it. Be careful when
enabling it.
--
Thanks,
David / dhildenb