linux/arch/microblaze
Mike Rapoport c3ab6baf6a mm/page_alloc: always initialize memory map for the holes
Patch series "mm: ensure consistency of memory map poisoning".

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.

This patch (of 4):

Currently memory map for the holes is initialized only when SPARSEMEM
memory model is used.  Yet, even with FLATMEM there could be holes in the
physical memory layout that have memory map entries.

For instance, the memory reserved using e820 API on i386 or
"reserved-memory" nodes in device tree would not appear in memblock.memory
and hence the struct pages for such holes will be skipped during memory
map initialization.

These struct pages will be zeroed because the memory map for FLATMEM
systems is allocated with memblock_alloc_node() that clears the allocated
memory.  While zeroed struct pages do not cause immediate problems, the
correct behaviour is to initialize every page using __init_single_page().
Besides, enabling page poison for FLATMEM case will trigger
PF_POISONED_CHECK() unless the memory map is properly initialized.

Make sure init_unavailable_range() is called for both SPARSEMEM and
FLATMEM so that struct pages representing memory holes would appear as
PG_Reserved with any memory layout.

[rppt@kernel.org: fix microblaze]
  Link: https://lkml.kernel.org/r/YQWW3RCE4eWBuMu/@kernel.org

Link: https://lkml.kernel.org/r/20210714123739.16493-1-rppt@kernel.org
Link: https://lkml.kernel.org/r/20210714123739.16493-2-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-09-03 09:58:15 -07:00
..
boot xsysace: Remove SYSACE driver 2021-03-23 10:27:38 -06:00
configs microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
include mm/page_alloc: always initialize memory map for the holes 2021-09-03 09:58:15 -07:00
kernel \n 2021-07-01 12:06:39 -07:00
lib microblaze: add 'fallthrough' to memcpy/memset/memmove 2021-04-22 09:34:05 +02:00
mm mm: move mem_init_print_info() into mm_init() 2021-04-30 11:20:42 -07:00
pci microblaze: Remove noMMU code 2020-11-26 16:39:35 +01:00
Kbuild kbuild: require all architectures to have arch/$(SRCARCH)/Kbuild 2021-05-26 23:10:37 +09:00
Kconfig mm: generalize ZONE_[DMA|DMA32] 2021-06-30 20:47:30 -07:00
Kconfig.debug docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
Kconfig.platform docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
Makefile arch: microblaze: Fix spelling mistake "vesion" -> "version" 2021-06-02 09:50:36 +02:00