Memory reliable feature is a memory tiering mechanism. It is based on kernel mirror feature, which splits memory into two sperate regions, mirrored(reliable) region and non-mirrored (non-reliable) region.
for kernel mirror feature:
allocate kernel memory from mirrored region by default
allocate user memory from non-mirrored region by default
non-mirrored region will be arranged into ZONE_MOVABLE.
for kernel reliable feature, it has additional features below:
normal user tasks never alloc memory from mirrored region with userspace apis(malloc, mmap, etc.)
special user tasks will allocate memory from mirrored region by default
tmpfs/pagecache allocate memory from mirrored region by default
upper limit of mirrored region allcated for user tasks, tmpfs and pagecache
Support Reliable fallback mechanism which allows special user tasks, tmpfs and pagecache can fallback to alloc non-mirrored region, it's the default setting.
In order to fulfil the goal
___GFP_RELIABILITY flag added for alloc memory from mirrored region.
the high_zoneidx for special user tasks/tmpfs/pagecache is set to ZONE_NORMAL.
normal user tasks could only alloc from ZONE_MOVABLE.
This patch is just the main framework, memory reliable support for special user tasks, pagecache and tmpfs has own patches.
To enable this function, mirrored(reliable) memory is needed and "kernelcore=reliable" should be added to kernel parameters.
Chen Wandun (4): mm: Add cmdline for the reliable memory usage of page cache proc/meminfo: Add "FileCache" item in /proc/meminfo mm: add "ReliableFileCache" item in /proc/meminfo mm: Add support for limiting the usage of reliable memory in pagecache
Ma Wupeng (17): mm: Drop shmem reliable related log during startup mm: Export static key mem_reliable mm: Export mem_reliable_status() for checking memory reliable status mm: Refactor code in reliable_report_meminfo() mm: Count reliable memory info based on zone info mm: Disable memory reliable when kdump is in progress mm: Clear GFP_RELIABLE if the conditions are not met mm: thp: Add memory reliable support for hugepaged collapse mm: Add reliable memory use limit for user tasks mm: Introduce fallback mechanism for memory reliable mm: Introduce shmem mirrored memory limit for memory reliable mm: Introduce reliable_debug=S to control shmem use mirrored memory mm: Introduce proc interface to disable memory reliable features mm: Show debug info about memory reliable if oom occurs mm: Update reliable flag in memory allocaion for reliable task only in task context mm/memblock: Introduce ability to alloc memory from specify memory reigon mm/hugetlb: Hugetlb use non-mirrored memory if memory reliable is enabled
Peng Wu (3): mm: Add kernel param for memory reliable mm: Add reliable_nr_page for accounting reliable memory proc: Count reliable memory usage of reliable tasks
Yu Liao (1): mm: Add sysctl to clear free list pages
Zhou Guanghui (1): shmem: Count and show reliable shmem info
.../admin-guide/kernel-parameters.txt | 13 + Documentation/admin-guide/sysctl/vm.rst | 13 + Documentation/filesystems/proc.rst | 8 + fs/proc/task_mmu.c | 1 + include/linux/mem_reliable.h | 124 ++++- include/linux/memblock.h | 5 + include/linux/mm.h | 6 +- include/linux/mm_inline.h | 4 + include/linux/mm_types.h | 3 +- include/linux/mmzone.h | 5 + kernel/events/uprobes.c | 2 + lib/show_mem.c | 1 + mm/Kconfig | 13 + mm/Makefile | 2 + mm/clear_freelist_page.c | 187 +++++++ mm/filemap.c | 9 +- mm/huge_memory.c | 8 + mm/hugetlb.c | 17 +- mm/khugepaged.c | 34 +- mm/ksm.c | 2 + mm/mem_reliable.c | 507 ++++++++++++++++-- mm/memblock.c | 107 ++++ mm/memory.c | 12 + mm/migrate.c | 10 + mm/mmap.c | 1 + mm/page_alloc.c | 135 ++++- mm/rmap.c | 5 + mm/shmem.c | 21 +- mm/swapfile.c | 2 + mm/userfaultfd.c | 1 + mm/vmscan.c | 2 + 31 files changed, 1183 insertions(+), 77 deletions(-) create mode 100644 mm/clear_freelist_page.c