patch-2.2.4 linux/arch/sparc/mm/init.c

Next file: linux/arch/sparc/mm/srmmu.c
Previous file: linux/arch/sparc/mm/fault.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/arch/sparc/mm/init.c linux/arch/sparc/mm/init.c
@@ -1,4 +1,4 @@
-/*  $Id: init.c,v 1.60 1998/09/13 04:30:31 davem Exp $
+/*  $Id: init.c,v 1.63 1999/03/20 22:02:01 davem Exp $
  *  linux/arch/sparc/mm/init.c
  *
  *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -37,6 +37,8 @@
 
 extern void show_net_buffers(void);
 
+unsigned long *sparc_valid_addr_bitmap;
+
 struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
 unsigned long sparc_unmapped_base;
 
@@ -215,16 +217,20 @@
 				unsigned long limit = base + sp_banks[tmp2].num_bytes;
 
 				if((phys_addr >= base) && (phys_addr < limit) &&
-				   ((phys_addr + PAGE_SIZE) < limit))
+				   ((phys_addr + PAGE_SIZE) < limit)) {
 					mem_map[MAP_NR(addr)].flags &= ~(1<<PG_reserved);
+					set_bit(MAP_NR(addr) >> 8, sparc_valid_addr_bitmap);
+				}
 			}
 		}
 	} else {
 		if((sparc_cpu_model == sun4m) || (sparc_cpu_model == sun4d)) {
 			srmmu_frob_mem_map(start_mem);
 		} else {
-			for(addr = start_mem; addr < end_mem; addr += PAGE_SIZE)
+			for(addr = start_mem; addr < end_mem; addr += PAGE_SIZE) {
 				mem_map[MAP_NR(addr)].flags &= ~(1<<PG_reserved);
+				set_bit(MAP_NR(addr) >> 8, sparc_valid_addr_bitmap);
+			}
 		}
 	}
 }
@@ -234,6 +240,7 @@
 	int codepages = 0;
 	int datapages = 0;
 	int initpages = 0; 
+	int i;
 	unsigned long addr;
 	struct page *page, *end;
 
@@ -243,6 +250,12 @@
 	end_mem &= PAGE_MASK;
 	max_mapnr = MAP_NR(end_mem);
 	high_memory = (void *) end_mem;
+	
+	sparc_valid_addr_bitmap = (unsigned long *)start_mem;
+	i = max_mapnr >> (8 + 5);
+	i += 1;
+	memset(sparc_valid_addr_bitmap, 0, i << 2);
+	start_mem += i << 2;
 
 	start_mem = PAGE_ALIGN(start_mem);
 	num_physpages = 0;
@@ -255,6 +268,7 @@
 		else
 #endif	
 			mem_map[MAP_NR(addr)].flags |= (1<<PG_reserved);
+		set_bit(MAP_NR(addr) >> 8, sparc_valid_addr_bitmap);
 		addr += PAGE_SIZE;
 	}
 
@@ -266,6 +280,9 @@
 		if (PageSkip(page)) {
 			unsigned long low, high;
 
+			/* See srmmu_frob_mem_map() for why this is done.  -DaveM */
+			page++;
+
 			low = PAGE_ALIGN((unsigned long)(page+1));
 			if (page->next_hash < page)
 				high = ((unsigned long)end) & PAGE_MASK;
@@ -313,11 +330,18 @@
 	       initpages << (PAGE_SHIFT-10),
 	       (unsigned long)PAGE_OFFSET, end_mem);
 
-	freepages.min = nr_free_pages >> 7;
-	if(freepages.min < 16)
-		freepages.min = 16;
-	freepages.low = freepages.min + (freepages.min >> 1);
-	freepages.high = freepages.min + freepages.min;
+	/* NOTE NOTE NOTE NOTE
+	 * Please keep track of things and make sure this
+	 * always matches the code in mm/page_alloc.c -DaveM
+	 */
+	i = nr_free_pages >> 7;
+	if (i < 48)
+		i = 48;
+	if (i > 256)
+		i = 256;
+	freepages.min = i;
+	freepages.low = i << 1;
+	freepages.high = freepages.low + i;
 }
 
 void free_initmem (void)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)