mm,kfence: decouple kfence from page granularity mapping judgement
JIRA: https://issues.redhat.com/browse/RHEL-2769
Backport a standalone change to decouple KFENCE from the early mapping
granularity decision that spans over all the available RAM.
Signed-off-by: Eric Chanudet echanude@redhat.com
How to test
A regular kernel (as opposed to -debug
kernel) has CONFIG_KFENCE=y
set. Without this series, it causes all the linear mappings to be made at page granularity independently of rodata=
setting. This uses more memory to hold the numerous, smaller, mappings in page-tables.
# sed -n 's/.*\(rodata=[^ ]\+\).*/\1/p' /proc/cmdline
# sed -n '/MemTotal:/p' /proc/meminfo
MemTotal: 35820768 kB
- Without this series, adding
rodata=off
to the kernel parameters has no effect on the linear mappings and/proc/meminfo
reports the sameMemTotal
with or withoutrodata=off
.
# sed -n 's/.*\(rodata=[^ ]\+\).*/\1/p' /proc/cmdline
rodata=off
# sed -n '/MemTotal:/p' /proc/meminfo
MemTotal: 35820768 kB
- With this series, adding
rodata=off
to the kernel parameters will have/proc/meminfo
report additional memory available inMemTotal
.
# sed -n 's/.*\(rodata=[^ ]\+\).*/\1/p' /proc/cmdline
rodata=off
# sed -n '/MemTotal:/p' /proc/meminfo
MemTotal: 35892480 kB
Edited by Eric Chanudet