free_initrd_mem() need to be correct
PATCH 1/1 free_initrd_mem() need to be correct
When I tried to boot kernel using 'memQ2m' option on Bigsur with 1GB memory, it failed and displayed the following message.
.
.
Freeing initrd memory: 746KB freed.
kernel BUG at page_alloc.c:86!
On our investigation, the cause is that:
(1) When 'mem=xxx' is used, it is possible that the page corresponds to the memory used by initrd is not made because initrd is loaded into high address region by bootloader.
(2) free_initrd_mem() frees the memory used by initrd even if its corresponding page was not exist.
The following patch corrects this problem.
arch/ia64/mm/init.c.new Thu Jun 28 09:57:58 2001 renamed from arch/ia64/mm/init.c Thu Jun 28 10:16:45 2001 +6 -4
@@ -141,10 +141,12 @@ printk ("Freeing initrd memory: %ldkB freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - clear_bit(PG_reserved, &virt_to_page(start)->flags); - set_page_count(virt_to_page(start), 1); - free_page(start); - ++totalram_pages; + if (VALID_PAGE(virt_to_page(start))) { + clear_bit(PG_reserved, &virt_to_page(start)->flags); + set_page_count(virt_to_page(start), 1); + free_page(start); + ++totalram_pages; + } } }
---
Takanori Kawano
Hitachi Ltd,
Internet Systems Platform Division
[email protected]