patch-2.4.0-test7 linux/arch/ia64/mm/init.c
Next file: linux/arch/ia64/mm/tlb.c
Previous file: linux/arch/ia64/lib/memcpy.S
Back to the patch index
Back to the overall index
- Lines: 49
- Date:
Fri Aug 11 19:09:06 2000
- Orig file:
v2.4.0-test6/linux/arch/ia64/mm/init.c
- Orig date:
Wed Aug 9 19:19:49 2000
diff -u --recursive --new-file v2.4.0-test6/linux/arch/ia64/mm/init.c linux/arch/ia64/mm/init.c
@@ -185,8 +185,42 @@
void
free_initrd_mem(unsigned long start, unsigned long end)
{
+ /*
+ * EFI uses 4KB pages while the kernel can use 4KB or bigger.
+ * Thus EFI and the kernel may have different page sizes. It is
+ * therefore possible to have the initrd share the same page as
+ * the end of the kernel (given current setup).
+ *
+ * To avoid freeing/using the wrong page (kernel sized) we:
+ * - align up the beginning of initrd
+ * - keep the end untouched
+ *
+ * | |
+ * |=============| a000
+ * | |
+ * | |
+ * | | 9000
+ * |/////////////|
+ * |/////////////|
+ * |=============| 8000
+ * |///INITRD////|
+ * |/////////////|
+ * |/////////////| 7000
+ * | |
+ * |KKKKKKKKKKKKK|
+ * |=============| 6000
+ * |KKKKKKKKKKKKK|
+ * |KKKKKKKKKKKKK|
+ * K=kernel using 8KB pages
+ *
+ * In this example, we must free page 8000 ONLY. So we must align up
+ * initrd_start and keep initrd_end as is.
+ */
+ start = PAGE_ALIGN(start);
+
if (start < end)
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);
@@ -423,5 +457,4 @@
#ifdef CONFIG_IA32_SUPPORT
ia32_gdt_init();
#endif
- return;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)