[PATCH 0/4] mm: ensure consistency of memory map poisoning

From: Mike Rapoport
Date: Wed Jul 14 2021 - 08:37:47 EST


From: Mike Rapoport <rppt@xxxxxxxxxxxxx>

Hi,

Currently memory map allocation for FLATMEM case does not poison the struct
pages regardless of CONFIG_PAGE_POISON setting.

This happens because allocation of the memory map for FLATMEM and SPARSMEM
use different memblock functions and those that are used for SPARSMEM case
(namely memblock_alloc_try_nid_raw() and memblock_alloc_exact_nid_raw())
implicitly poison the allocated memory.

Another side effect of this implicit poisoning is that early setup code
that uses the same functions to allocate memory burns cycles for the memory
poisoning even if it was not intended.

These patches introduce memmap_alloc() wrapper that ensure that the memory
map allocation is consistent for different memory models.

Mike Rapoport (4):
mm/page_alloc: always initialize memory map for the holes
microblaze: simplify pte_alloc_one_kernel()
mm: introduce memmap_alloc() to unify memory map allocation
memblock: stop poisoning raw allocations

arch/microblaze/include/asm/pgtable.h | 2 --
arch/microblaze/mm/init.c | 12 ----------
arch/microblaze/mm/pgtable.c | 17 +++++++-------
mm/internal.h | 4 ++++
mm/memblock.c | 20 ++++-------------
mm/page_alloc.c | 32 ++++++++++++++++++---------
mm/sparse.c | 6 ++---
7 files changed, 40 insertions(+), 53 deletions(-)


base-commit: e73f0f0ee7541171d89f2e2491130c7771ba58d3
--
2.28.0