patch-2.1.36 linux/arch/alpha/mm/init.c

Next file: linux/arch/alpha/vmlinux.lds
Previous file: linux/arch/alpha/kernel/traps.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/arch/alpha/mm/init.c linux/arch/alpha/mm/init.c
@@ -150,7 +150,7 @@
 	start_mem = PAGE_ALIGN(start_mem);
 
 	/*
-	 * Mark the pages used by the kernel as reserved..
+	 * Mark the pages used by the kernel as reserved.
 	 */
 	tmp = KERNEL_START;
 	while (tmp < start_mem) {
@@ -171,9 +171,19 @@
 	return;
 }
 
-void free_initmem(void)
+void free_initmem (void)
 {
-	/* To be written */
+        extern char __init_begin, __init_end;
+        unsigned long addr;
+
+        addr = (unsigned long)(&__init_begin);
+        for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
+                mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved);
+                atomic_set(&mem_map[MAP_NR(addr)].count, 1);
+                free_page(addr);
+        }
+        printk ("Freeing unused kernel memory: %dk freed\n",
+		(&__init_end - &__init_begin) >> 10);
 }
 
 void si_meminfo(struct sysinfo *val)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov