]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
mm: don't do zero_resv_unavail if memmap is not allocated
authorPavel Tatashin <pasha.tatashin@oracle.com>
Mon, 16 Jul 2018 15:16:30 +0000 (11:16 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commitafa11cd38426807466e3c746159af90d3a2b4402
treeae911c6526a17a9413ea9141c4fa260282f7d828
parent7f180edd1a2712a68ae3f9f8c812c63fb9844f15
mm: don't do zero_resv_unavail if memmap is not allocated

BugLink: http://bugs.launchpad.net/bugs/1810554
commit d1b47a7c9efcf3c3384b70f6e3c8f1423b44d8c7 upstream.

Moving zero_resv_unavail before memmap_init_zone(), caused a regression on
x86-32.

The cause is that we access struct pages before they are allocated when
CONFIG_FLAT_NODE_MEM_MAP is used.

free_area_init_nodes()
  zero_resv_unavail()
    mm_zero_struct_page(pfn_to_page(pfn)); <- struct page is not alloced
  free_area_init_node()
    if CONFIG_FLAT_NODE_MEM_MAP
      alloc_node_mem_map()
        memblock_virt_alloc_node_nopanic() <- struct page alloced here

On the other hand memblock_virt_alloc_node_nopanic() zeroes all the memory
that it returns, so we do not need to do zero_resv_unavail() here.

Fixes: e181ae0c5db9 ("mm: zero unavailable pages before memmap init")
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Tested-by: Matt Hart <matt@mattface.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/linux/mm.h
mm/page_alloc.c