lkml.org 
[lkml]   [2003]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] fix alloc_bootmem_low_pages
From
This patch is needed for some discontig boxes since the memory maps may
be built out-of-order.

Jesse

diff -Nru a/mm/bootmem.c b/mm/bootmem.c
--- a/mm/bootmem.c Thu Jul 17 16:59:05 2003
+++ b/mm/bootmem.c Thu Jul 17 16:59:05 2003
@@ -48,8 +48,24 @@
bootmem_data_t *bdata = pgdat->bdata;
unsigned long mapsize = ((end - start)+7)/8;

- pgdat->pgdat_next = pgdat_list;
- pgdat_list = pgdat;
+
+ /*
+ * sort pgdat_list so that the lowest one comes first,
+ * which makes alloc_bootmem_low_pages work as desired.
+ */
+ if (!pgdat_list || pgdat_list->node_start_pfn > pgdat->node_start_pfn) {
+ pgdat->pgdat_next = pgdat_list;
+ pgdat_list = pgdat;
+ } else {
+ pg_data_t *tmp = pgdat_list;
+ while (tmp->pgdat_next) {
+ if (tmp->pgdat_next->node_start_pfn > pgdat->node_start_pfn)
+ break;
+ tmp = tmp->pgdat_next;
+ }
+ pgdat->pgdat_next = tmp->pgdat_next;
+ tmp->pgdat_next = pgdat;
+ }

mapsize = (mapsize + (sizeof(long) - 1UL)) & ~(sizeof(long) - 1UL);
bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.045 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site