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 set_highmem_pages_init(int bad_ppro) void __init one_highpage_init(struct page *page, int pfn, int bad_ppro)
{ {
int pfn;
for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) {
struct page *page = mem_map + pfn;
if (!page_is_ram(pfn)) { if (!page_is_ram(pfn)) {
SetPageReserved(page); SetPageReserved(page);
continue; return;
} }
if (bad_ppro && page_kills_ppro(pfn)) if (bad_ppro && page_kills_ppro(pfn)) {
{
SetPageReserved(page); SetPageReserved(page);
continue; return;
} }
ClearPageReserved(page); ClearPageReserved(page);
set_bit(PG_highmem, &page->flags); set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1); atomic_set(&page->count, 1);
__free_page(page); __free_page(page);
totalhigh_pages++; totalhigh_pages++;
} }
void __init set_highmem_pages_init(int bad_ppro)
{
int pfn;
for (pfn = highstart_pfn; pfn < highend_pfn; pfn++)
one_highpage_init((struct page *)(mem_map + pfn), pfn, bad_ppro);
totalram_pages += totalhigh_pages; totalram_pages += totalhigh_pages;
} }
...@@ -406,6 +407,16 @@ void __init test_wp_bit(void) ...@@ -406,6 +407,16 @@ void __init test_wp_bit(void)
} }
} }
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