patch-2.4.21 linux-2.4.21/arch/alpha/mm/numa.c
Next file: linux-2.4.21/arch/alpha/mm/remap.c
Previous file: linux-2.4.21/arch/alpha/mm/init.c
Back to the patch index
Back to the overall index
- Lines: 199
- Date:
2003-06-13 07:51:29.000000000 -0700
- Orig file:
linux-2.4.20/arch/alpha/mm/numa.c
- Orig date:
2002-08-02 17:39:42.000000000 -0700
diff -urN linux-2.4.20/arch/alpha/mm/numa.c linux-2.4.21/arch/alpha/mm/numa.c
@@ -64,20 +64,22 @@
unsigned long bootmap_size, bootmap_pages, bootmap_start;
unsigned long start, end;
unsigned long node_pfn_start, node_pfn_end;
+ unsigned long node_min_pfn, node_max_pfn;
int i;
unsigned long node_datasz = PFN_UP(sizeof(plat_pg_data_t));
int show_init = 0;
/* Find the bounds of current node */
- node_pfn_start = (nid * NODE_MAX_MEM_SIZE) >> PAGE_SHIFT;
- node_pfn_end = node_pfn_start + (NODE_MAX_MEM_SIZE >> PAGE_SHIFT);
+ node_pfn_start = (NODE_MEM_START(nid)) >> PAGE_SHIFT;
+ node_pfn_end = node_pfn_start + (NODE_MEM_SIZE(nid) >> PAGE_SHIFT);
/* Find free clusters, and init and free the bootmem accordingly. */
memdesc = (struct memdesc_struct *)
(hwrpb->mddt_offset + (unsigned long) hwrpb);
- /* find the bounds of this node (min_low_pfn/max_low_pfn) */
- min_low_pfn = ~0UL;
+ /* find the bounds of this node (node_min_pfn/node_max_pfn) */
+ node_min_pfn = ~0UL;
+ node_max_pfn = 0UL;
for_each_mem_cluster(memdesc, cluster, i) {
/* Bit 0 is console/PALcode reserved. Bit 1 is
non-volatile memory -- we might want to mark
@@ -104,36 +106,46 @@
if (end > node_pfn_end)
end = node_pfn_end;
- if (start < min_low_pfn)
- min_low_pfn = start;
- if (end > max_low_pfn)
- max_low_pfn = end;
+ if (start < node_min_pfn)
+ node_min_pfn = start;
+ if (end > node_max_pfn)
+ node_max_pfn = end;
}
- if (mem_size_limit && max_low_pfn >= mem_size_limit) {
- printk("setup: forcing memory size to %ldK (from %ldK).\n",
- mem_size_limit << (PAGE_SHIFT - 10),
- max_low_pfn << (PAGE_SHIFT - 10));
- max_low_pfn = mem_size_limit;
+ if (mem_size_limit && node_max_pfn > mem_size_limit) {
+ static int msg_shown = 0;
+ if (!msg_shown) {
+ msg_shown = 1;
+ printk("setup: forcing memory size to %ldK (from %ldK).\n",
+ mem_size_limit << (PAGE_SHIFT - 10),
+ node_max_pfn << (PAGE_SHIFT - 10));
+ }
+ node_max_pfn = mem_size_limit;
}
- if (min_low_pfn >= max_low_pfn)
+ if (node_min_pfn >= node_max_pfn)
return;
- num_physpages += max_low_pfn - min_low_pfn;
+ /* Update global {min,max}_low_pfn from node information. */
+ if (node_min_pfn < min_low_pfn)
+ min_low_pfn = node_min_pfn;
+ if (node_max_pfn > max_low_pfn)
+ max_low_pfn = node_max_pfn;
+
+ num_physpages += node_max_pfn - node_min_pfn;
/* Cute trick to make sure our local node data is on local memory */
- PLAT_NODE_DATA(nid) = (plat_pg_data_t *)(__va(min_low_pfn << PAGE_SHIFT));
+ PLAT_NODE_DATA(nid) = (plat_pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT));
/* Quasi-mark the plat_pg_data_t as in-use */
- min_low_pfn += node_datasz;
- if (min_low_pfn >= max_low_pfn) {
+ node_min_pfn += node_datasz;
+ if (node_min_pfn >= node_max_pfn) {
printk(" not enough mem to reserve PLAT_NODE_DATA");
return;
}
NODE_DATA(nid)->bdata = &plat_node_bdata[nid];
printk(" Detected node memory: start %8lu, end %8lu\n",
- min_low_pfn, max_low_pfn);
+ node_min_pfn, node_max_pfn);
DBGDCONT(" DISCONTIG: plat_node_data[%d] is at 0x%p\n", nid, PLAT_NODE_DATA(nid));
DBGDCONT(" DISCONTIG: NODE_DATA(%d)->bdata is at 0x%p\n", nid, NODE_DATA(nid)->bdata);
@@ -143,15 +155,15 @@
end_kernel_pfn = PFN_UP(virt_to_phys(kernel_end));
bootmap_start = -1;
- if (!nid && (max_low_pfn < end_kernel_pfn || min_low_pfn > start_kernel_pfn))
+ if (!nid && (node_max_pfn < end_kernel_pfn || node_min_pfn > start_kernel_pfn))
panic("kernel loaded out of ram");
/* Zone start phys-addr must be 2^(MAX_ORDER-1) aligned */
- min_low_pfn = (min_low_pfn + ((1UL << (MAX_ORDER-1))-1)) & ~((1UL << (MAX_ORDER-1))-1);
+ node_min_pfn = (node_min_pfn + ((1UL << (MAX_ORDER-1))-1)) & ~((1UL << (MAX_ORDER-1))-1);
/* We need to know how many physically contiguous pages
we'll need for the bootmap. */
- bootmap_pages = bootmem_bootmap_pages(max_low_pfn-min_low_pfn);
+ bootmap_pages = bootmem_bootmap_pages(node_max_pfn-node_min_pfn);
/* Now find a good region where to allocate the bootmap. */
for_each_mem_cluster(memdesc, cluster, i) {
@@ -161,13 +173,13 @@
start = cluster->start_pfn;
end = start + cluster->numpages;
- if (start >= max_low_pfn || end <= min_low_pfn)
+ if (start >= node_max_pfn || end <= node_min_pfn)
continue;
- if (end > max_low_pfn)
- end = max_low_pfn;
- if (start < min_low_pfn)
- start = min_low_pfn;
+ if (end > node_max_pfn)
+ end = node_max_pfn;
+ if (start < node_min_pfn)
+ start = node_min_pfn;
if (start < start_kernel_pfn) {
if (end > end_kernel_pfn
@@ -189,7 +201,7 @@
/* Allocate the bootmap and mark the whole MM as reserved. */
bootmap_size = init_bootmem_node(NODE_DATA(nid), bootmap_start,
- min_low_pfn, max_low_pfn);
+ node_min_pfn, node_max_pfn);
DBGDCONT(" bootmap_start %lu, bootmap_size %lu, bootmap_pages %lu\n",
bootmap_start, bootmap_size, bootmap_pages);
@@ -201,13 +213,13 @@
start = cluster->start_pfn;
end = cluster->start_pfn + cluster->numpages;
- if (start >= max_low_pfn || end <= min_low_pfn)
+ if (start >= node_max_pfn || end <= node_min_pfn)
continue;
- if (end > max_low_pfn)
- end = max_low_pfn;
- if (start < min_low_pfn)
- start = min_low_pfn;
+ if (end > node_max_pfn)
+ end = node_max_pfn;
+ if (start < node_min_pfn)
+ start = node_min_pfn;
if (start < start_kernel_pfn) {
if (end > end_kernel_pfn) {
@@ -243,22 +255,27 @@
show_mem_layout();
numnodes = 0;
+
+ min_low_pfn = ~0UL;
+ max_low_pfn = 0UL;
for (nid = 0; nid < MAX_NUMNODES; nid++)
setup_memory_node(nid, kernel_end);
#ifdef CONFIG_BLK_DEV_INITRD
initrd_start = INITRD_START;
if (initrd_start) {
+ extern void *move_initrd(unsigned long);
+
initrd_end = initrd_start+INITRD_SIZE;
printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
(void *) initrd_start, INITRD_SIZE);
if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) {
- printk("initrd extends beyond end of memory "
- "(0x%08lx > 0x%p)\ndisabling initrd\n",
- initrd_end,
- phys_to_virt(PFN_PHYS(max_low_pfn)));
- initrd_start = initrd_end = 0;
+ if (!move_initrd(PFN_PHYS(max_low_pfn)))
+ printk("initrd extends beyond end of memory "
+ "(0x%08lx > 0x%p)\ndisabling initrd\n",
+ initrd_end,
+ phys_to_virt(PFN_PHYS(max_low_pfn)));
} else {
reserve_bootmem_node(NODE_DATA(KVADDR_TO_NID(initrd_start)),
virt_to_phys((void *)initrd_start),
@@ -383,8 +400,8 @@
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, "
- "%luk data, %luk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
+ "%luk data, %luk init)\n",
+ (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
num_physpages << (PAGE_SHIFT-10),
codesize >> 10,
reservedpages << (PAGE_SHIFT-10),
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)