]> git.baikalelectronics.ru Git - kernel.git/commit
mm: zero unavailable pages before memmap init
authorPavel Tatashin <pasha.tatashin@oracle.com>
Sat, 14 Jul 2018 13:15:07 +0000 (09:15 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Jul 2018 18:02:20 +0000 (11:02 -0700)
commite1932a51ee82b4e124ec5de1ba0a231b1dcb61bb
tree4af6ac8786ab6cc14c292b8dbf8aa8b75de62b30
parent0701dfe656049f79376f692015fe0a2fb87b9850
mm: zero unavailable pages before memmap init

We must zero struct pages for memory that is not backed by physical
memory, or kernel does not have access to.

Recently, there was a change which zeroed all memmap for all holes in
e820.  Unfortunately, it introduced a bug that is discussed here:

  https://www.spinics.net/lists/linux-mm/msg156764.html

Linus, also saw this bug on his machine, and confirmed that reverting
commit a04cb324c3fa ("x86/e820: put !E820_TYPE_RAM regions into
memblock.reserved") fixes the issue.

The problem is that we incorrectly zero some struct pages after they
were setup.

The fix is to zero unavailable struct pages prior to initializing of
struct pages.

A more detailed fix should come later that would avoid double zeroing
cases: one in __init_single_page(), the other one in
zero_resv_unavail().

Fixes: a04cb324c3fa ("x86/e820: put !E820_TYPE_RAM regions into memblock.reserved")
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c