Revert "mm: Always release pages to the buddy allocator in memblock_free_late()."

This reverts commit 115d9d77bb.
 
 The pages being freed by memblock_free_late() have already been
 initialized, but if they are in the deferred init range, __free_one_page()
 might access nearby uninitialized pages when trying to coalesce buddies,
 which will cause a crash.
 
 A proper fix will be more involved so revert this change for the time
 being.
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCgAuFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmPnaSQQHHJwcHRAa2Vy
 bmVsLm9yZwAKCRA5A4Ymyw79kQl5B/42xQ7QDacxL+okyQXYUytC5DqZ8+1bL5uU
 bHg4rNyR7/+7r+D0p6z7MhpeoSdXMSgSLGbx8joaXDNhyNtQqMSj19IQjtzndj4L
 pzH5jQ5RJR9ePJBJ3Mq3uInaEvACzPIkfyvHAT4JE65jle8WQ5F5BJ+TzwlWOU0Q
 cf9orYTIlDp50saJ/rrw0WKelSZ1oCQJnvFsgIfshmD4b3fZ+X70gsIRAcvqizgw
 gszZmpIkgU6idLlboku0jnVTkW2f1C5ZplrDrFXaDbai5mSviPSA7I3TsTA495iD
 bwo6xAaPeVOoJOnu7XvKs0e2MFKIfNPIcGzxJe+4vSS+i4W62uyC
 =h6Xh
 -----END PGP SIGNATURE-----

Merge tag 'fixes-2023-02-11' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock

Pull memblock revert from Mike Rapoport:
 "Revert 'mm: Always release pages to the buddy allocator in
  memblock_free_late()'

  The pages being freed by memblock_free_late() have already been
  initialized, but if they are in the deferred init range,
  __free_one_page() might access nearby uninitialized pages when trying
  to coalesce buddies, which will cause a crash.

  A proper fix will be more involved so revert this change for the time
  being"

* tag 'fixes-2023-02-11' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  Revert "mm: Always release pages to the buddy allocator in memblock_free_late()."
This commit is contained in:
Linus Torvalds 2023-02-11 10:51:45 -08:00
commit 230809c145
2 changed files with 1 additions and 11 deletions

View File

@ -1640,13 +1640,7 @@ void __init memblock_free_late(phys_addr_t base, phys_addr_t size)
end = PFN_DOWN(base + size);
for (; cursor < end; cursor++) {
/*
* Reserved pages are always initialized by the end of
* memblock_free_all() (by memmap_init() and, if deferred
* initialization is enabled, memmap_init_reserved_pages()), so
* these pages can be released directly to the buddy allocator.
*/
__free_pages_core(pfn_to_page(cursor), 0);
memblock_free_pages(pfn_to_page(cursor), cursor, 0);
totalram_pages_inc();
}
}

View File

@ -15,10 +15,6 @@ bool mirrored_kernelcore = false;
struct page {};
void __free_pages_core(struct page *page, unsigned int order)
{
}
void memblock_free_pages(struct page *page, unsigned long pfn,
unsigned int order)
{