i386: nid_zone_sizes_init() update
PATCH 1/1 i386: nid_zone_sizes_init() update
Broken out nid_zone_sizes_init() change from i386 NUMA emulation code.
---
Applies on top of linux-2.6.14-rc2-git8-mhp1
arch/i386/kernel/setup.c +9 -16
@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line
Broken out
nid_zone_sizes_init()change from i386 NUMA emulation code.
Mmmm. what's the purpose of this change? Not sure I understand what you're trying to acheive here ... looks like you're just removing some abstractions? To me, they made the code a bit easier to read.
Quoted 50 lines
Signed-off-by Magnus Damm <[email protected]>---
Applies on top of linux-2.6.14-rc2-git8-mhp1
arch/i386/kernel/setup.c +9
-17@@ -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, --
Quoted 6 lines
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Martin J. Bligh
Quoted 1 line
Broken out
nid_zone_sizes_init()change from i386 NUMA emulation code.Mmmm. what's the purpose of this change? Not sure I understand what you're trying to acheive here ... looks like you're just removing some abstractions? To me, they made the code a bit easier to read.
Thanks for the compliment. Perhaps we should merge this patch upstream:
-- Dave
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Magnus Damm
Broken out
nid_zone_sizes_init()change from i386 NUMA emulation code.
...
arch/i386/kernel/setup.c static inline unsigned long max_hardware · line 1225
Quoted 8 lines
arch/i386/kernel/setup.c +0
-8-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; -}
Hey, I liked those helpers!
When I suggested that you make your patches apply on top of the existing -mhp stuff, I didn't just mean that they should _apply_, they should probably mesh a little bit better. For instance, it would be very helpful to use those 'static inlines', or make a couple new ones if you need them.
-- Dave
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 13 lines · Dave Hansen
Quoted 1 line · Magnus Damm
Broken out
nid_zone_sizes_init()change from i386 NUMA emulation code....
arch/i386/kernel/setup.c static inline unsigned long max_hardware · line 1225
Quoted 8 lines
arch/i386/kernel/setup.c +0
-8-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; -}Hey, I liked those helpers!
Well, too bad for you! ;)
Quoted 5 lines
When I suggested that you make your patches apply on top of the existing -mhp stuff, I didn't just mean that they should _apply_, they should probably mesh a little bit better. For instance, it would be very helpful to use those 'static inlines', or make a couple new ones if you need them.
Okey, I think I understand. And I agree that more effort could be put into this to make the code look better. I thought this change was required for the NUMA emulation code, but it turns out it wasn't. I guess keeping the code as is and ignoring the patch is probably the best solution.
Thanks!
/ magnus
--
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/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>