Commit 6db13e2b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] restructure mem_init for ia32 discontigmem

 - Pull the middle out of one_highpage_init() so that the i386 NUMA
   patch can call it on a per-page basis.

 - Move a few lines out of mem_init() into the new
   set_max_mapnr_init(), which the i386 NUMA code requires.
parent b9ba3a05
...@@ -213,27 +213,28 @@ void __init permanent_kmaps_init(pgd_t *pgd_base) ...@@ -213,27 +213,28 @@ void __init permanent_kmaps_init(pgd_t *pgd_base)
pkmap_page_table = pte; pkmap_page_table = pte;
} }
void __init one_highpage_init(struct page *page, int pfn, int bad_ppro)
{
if (!page_is_ram(pfn)) {
SetPageReserved(page);
return;
}
if (bad_ppro && page_kills_ppro(pfn)) {
SetPageReserved(page);
return;
}
ClearPageReserved(page);
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
__free_page(page);
totalhigh_pages++;
}
void __init set_highmem_pages_init(int bad_ppro) void __init set_highmem_pages_init(int bad_ppro)
{ {
int pfn; int pfn;
for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) { for (pfn = highstart_pfn; pfn < highend_pfn; pfn++)
struct page *page = mem_map + pfn; one_highpage_init((struct page *)(mem_map + pfn), pfn, bad_ppro);
if (!page_is_ram(pfn)) {
SetPageReserved(page);
continue;
}
if (bad_ppro && page_kills_ppro(pfn))
{
SetPageReserved(page);
continue;
}
ClearPageReserved(page);
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
__free_page(page);
totalhigh_pages++;
}
totalram_pages += totalhigh_pages; totalram_pages += totalhigh_pages;
} }
...@@ -405,7 +406,17 @@ void __init test_wp_bit(void) ...@@ -405,7 +406,17 @@ void __init test_wp_bit(void)
printk("Ok.\n"); printk("Ok.\n");
} }
} }
static void __init set_max_mapnr_init(void)
{
#ifdef CONFIG_HIGHMEM
highmem_start_page = mem_map + highstart_pfn;
max_mapnr = num_physpages = highend_pfn;
#else
max_mapnr = num_physpages = max_low_pfn;
#endif
}
void __init mem_init(void) void __init mem_init(void)
{ {
extern int ppro_with_ram_bug(void); extern int ppro_with_ram_bug(void);
...@@ -418,12 +429,8 @@ void __init mem_init(void) ...@@ -418,12 +429,8 @@ void __init mem_init(void)
bad_ppro = ppro_with_ram_bug(); bad_ppro = ppro_with_ram_bug();
#ifdef CONFIG_HIGHMEM set_max_mapnr_init();
highmem_start_page = mem_map + highstart_pfn;
max_mapnr = num_physpages = highend_pfn;
#else
max_mapnr = num_physpages = max_low_pfn;
#endif
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
/* clear the zero-page */ /* clear the zero-page */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment