Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99976
b: refs/heads/master
c: 7482b0e
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Jul 8, 2008
1 parent a622fb9 commit 95167df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: df366e9822beca97115ba9745cbe1ea1f26fb111
refs/heads/master: 7482b0e962e128c5b574aa29761f97164189ef14
24 changes: 14 additions & 10 deletions trunk/arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
unsigned pages_2m = 0, pages_4k = 0;
unsigned limit_pfn = end >> PAGE_SHIFT;

pgd_idx = pgd_index(PAGE_OFFSET);
pgd_idx = pgd_index(start + PAGE_OFFSET);
pgd = pgd_base + pgd_idx;
pfn = start >> PAGE_SHIFT;

Expand All @@ -218,7 +218,8 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
* and overlapping MTRRs into large pages can cause
* slowdowns.
*/
if (cpu_has_pse && !(pgd_idx == 0 && pmd_idx == 0)) {
if (cpu_has_pse && !(pgd_idx == 0 && pmd_idx == 0) &&
(pfn + PTRS_PER_PTE) <= limit_pfn) {
unsigned int addr2;
pgprot_t prot = PAGE_KERNEL_LARGE;

Expand All @@ -233,13 +234,12 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
set_pmd(pmd, pfn_pmd(pfn, prot));

pfn += PTRS_PER_PTE;
max_pfn_mapped = pfn;
continue;
}
pte = one_page_table_init(pmd);

for (pte_ofs = 0;
pte_ofs < PTRS_PER_PTE && pfn < max_low_pfn;
pte_ofs < PTRS_PER_PTE && pfn < limit_pfn;
pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) {
pgprot_t prot = PAGE_KERNEL;

Expand All @@ -249,7 +249,6 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
pages_4k++;
set_pte(pte, pfn_pte(pfn, prot));
}
max_pfn_mapped = pfn;
}
}
update_page_count(PG_LEVEL_2M, pages_2m);
Expand Down Expand Up @@ -729,18 +728,23 @@ void __init setup_bootmem_allocator(void)

static void __init find_early_table_space(unsigned long end)
{
unsigned long puds, pmds, tables, start;
unsigned long puds, pmds, ptes, tables, start;

puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
tables = PAGE_ALIGN(puds * sizeof(pud_t));

pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
tables += PAGE_ALIGN(pmds * sizeof(pmd_t));

if (!cpu_has_pse) {
int ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
tables += PAGE_ALIGN(ptes * sizeof(pte_t));
}
if (cpu_has_pse) {
unsigned long extra;
extra = end - ((end>>21) << 21);
extra += (2UL<<20);
ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
} else
ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;

tables += PAGE_ALIGN(ptes * sizeof(pte_t));

/*
* RED-PEN putting page tables only on node 0 could
Expand Down

0 comments on commit 95167df

Please sign in to comment.