Skip to contentSkip to conversation

Cleanup i386 discontigmem [2/2]

PATCH Martin J. Bligh 1 participant 1 message Aug 23, 2002 Memory management

lore
Share & tools
lore
#0 lore raw

This mainly just rips out some magic extra structures in the boot time code to determine node sizes, and counts in pages instead of bytes. Oh, and I put the code that allocates pgdat into allocage_pgdat, instead of find_max_pfn_node, which seems like an incongruous home for it.

No functionality changes, nothing touched outside i386 discontigmem ... just makes code cleaner and more readable. Tested on 16-way NUMA-Q.

Please apply to your tree, and feed upwards ;-)

M.

------------------

arch/i386/kernel/numaq.c +10 -8
diff -urN -X /home/mbligh/.diff.exclude 2.5.31-25-clean_plat/arch/i386/kernel/numaq.c 2.5.31-26-clean_boot/arch/i386/kernel/numaq.c
@@ -29,8 +29,11 @@
 #include <linux/mmzone.h>
 #include <asm/numaq.h>
 
-u64 nodes_mem_start[MAX_NUMNODES];
-u64 nodes_mem_size[MAX_NUMNODES];
+/* These are needed before the pgdat's are created */
+unsigned long node_start_pfn[MAX_NUMNODES];
+unsigned long node_end_pfn[MAX_NUMNODES];
+
+#define	MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
 
 /*
  * Function: smp_dump_qct()
@@ -46,17 +49,16 @@
 	struct sys_cfg_data *scd =
 		(struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
 
-#define	MB_TO_B(addr) ((addr) << 20)
 	numnodes = 0;
 	for(node = 0; node < MAX_NUMNODES; node++) {
 		if(scd->quads_present31_0 & (1 << node)) {
 			numnodes++;
 			eq = &scd->eq[node];
-			/* Convert to bytes */
-			nodes_mem_start[node] = MB_TO_B((u64)eq->hi_shrd_mem_start -
-							(u64)eq->priv_mem_size);
-			nodes_mem_size[node] = MB_TO_B((u64)eq->hi_shrd_mem_size +
-						       (u64)eq->priv_mem_size);
+			/* Convert to pages */
+			node_start_pfn[node] = MB_TO_PAGES(
+				eq->hi_shrd_mem_start - eq->priv_mem_size);
+			node_end_pfn[node] = MB_TO_PAGES(
+				eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
 		}
 	}
 }
arch/i386/mm/discontig.c +20 -27

82 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/