linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386: nid_zone_sizes_init() update
@ 2005-10-05  8:35 Magnus Damm
  2005-10-05 15:10 ` Martin J. Bligh
  2005-10-05 16:12 ` Dave Hansen
  0 siblings, 2 replies; 5+ messages in thread
From: Magnus Damm @ 2005-10-05  8:35 UTC (permalink / raw)
  To: linux-mm; +Cc: Magnus Damm

Broken out nid_zone_sizes_init() change from i386 NUMA emulation code.

Signed-off-by: Magnus Damm <magnus@valinux.co.jp>
---

Applies on top of linux-2.6.14-rc2-git8-mhp1

--- from-0053/arch/i386/kernel/setup.c
+++ to-work/arch/i386/kernel/setup.c	2005-10-04 15:18:54.000000000 +0900
@@ -1215,31 +1215,24 @@ static inline unsigned long max_hardware
 {
 	return virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 }
-static inline unsigned long  nid_size_pages(int nid)
-{
-	return node_end_pfn[nid] - node_start_pfn[nid];
-}
-static inline int nid_starts_in_highmem(int nid)
-{
-	return node_start_pfn[nid] >= max_low_pfn;
-}
 
 void __init nid_zone_sizes_init(int nid)
 {
 	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
-	unsigned long max_dma;
+	unsigned long max_dma = min(max_hardware_dma_pfn(), max_low_pfn);
 	unsigned long start = node_start_pfn[nid];
 	unsigned long end = node_end_pfn[nid];
 
 	if (node_has_online_mem(nid)){
-		if (nid_starts_in_highmem(nid)) {
-			zones_size[ZONE_HIGHMEM] = nid_size_pages(nid);
-		} else {
-			max_dma = min(max_hardware_dma_pfn(), max_low_pfn);
-			zones_size[ZONE_DMA] = max_dma;
-			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
-			zones_size[ZONE_HIGHMEM] = end - max_low_pfn;
+		if (start < max_dma) {
+			zones_size[ZONE_DMA] = min(end, max_dma) - start;
+		}
+		if (start < max_low_pfn && max_dma < end) {
+			zones_size[ZONE_NORMAL] = min(end, max_low_pfn) - max(start, max_dma);
 		}
+		if (max_low_pfn <= end) {
+			zones_size[ZONE_HIGHMEM] = end - max(start, max_low_pfn);
+               }
 	}
 
 	free_area_init_node(nid, NODE_DATA(nid), zones_size, start,

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-06 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-05  8:35 [PATCH] i386: nid_zone_sizes_init() update Magnus Damm
2005-10-05 15:10 ` Martin J. Bligh
2005-10-05 16:25   ` Dave Hansen
2005-10-05 16:12 ` Dave Hansen
2005-10-06 10:38   ` Magnus Damm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox