Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356217
b: refs/heads/master
c: 1829ae9
h: refs/heads/master
i:
  356215: e5ab2c5
v: v3
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Nov 17, 2012
1 parent 6706ea6 commit 979d144
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 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: 84d770019bb990dcd8013d9d08174d0e1516b517
refs/heads/master: 1829ae9ad7380bf17333ab9ad1610631d9cb8664
29 changes: 14 additions & 15 deletions trunk/arch/x86/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,72 +204,71 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
unsigned long end)
{
unsigned long start_pfn, end_pfn;
unsigned long pos;
unsigned long pfn;
int i;

/* head if not big page alignment ? */
start_pfn = PFN_DOWN(start);
pos = PFN_PHYS(start_pfn);
pfn = start_pfn = PFN_DOWN(start);
#ifdef CONFIG_X86_32
/*
* Don't use a large page for the first 2/4MB of memory
* because there are often fixed size MTRRs in there
* and overlapping MTRRs into large pages can cause
* slowdowns.
*/
if (pos == 0)
if (pfn == 0)
end_pfn = PFN_DOWN(PMD_SIZE);
else
end_pfn = PFN_DOWN(round_up(pos, PMD_SIZE));
end_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
#else /* CONFIG_X86_64 */
end_pfn = PFN_DOWN(round_up(pos, PMD_SIZE));
end_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
#endif
if (end_pfn > PFN_DOWN(end))
end_pfn = PFN_DOWN(end);
if (start_pfn < end_pfn) {
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
pos = PFN_PHYS(end_pfn);
pfn = end_pfn;
}

/* big page (2M) range */
start_pfn = PFN_DOWN(round_up(pos, PMD_SIZE));
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
#ifdef CONFIG_X86_32
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
#else /* CONFIG_X86_64 */
end_pfn = PFN_DOWN(round_up(pos, PUD_SIZE));
end_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
if (end_pfn > PFN_DOWN(round_down(end, PMD_SIZE)))
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
#endif

if (start_pfn < end_pfn) {
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
page_size_mask & (1<<PG_LEVEL_2M));
pos = PFN_PHYS(end_pfn);
pfn = end_pfn;
}

#ifdef CONFIG_X86_64
/* big page (1G) range */
start_pfn = PFN_DOWN(round_up(pos, PUD_SIZE));
start_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
end_pfn = PFN_DOWN(round_down(end, PUD_SIZE));
if (start_pfn < end_pfn) {
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
page_size_mask &
((1<<PG_LEVEL_2M)|(1<<PG_LEVEL_1G)));
pos = PFN_PHYS(end_pfn);
pfn = end_pfn;
}

/* tail is not big page (1G) alignment */
start_pfn = PFN_DOWN(round_up(pos, PMD_SIZE));
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
if (start_pfn < end_pfn) {
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
page_size_mask & (1<<PG_LEVEL_2M));
pos = PFN_PHYS(end_pfn);
pfn = end_pfn;
}
#endif

/* tail is not big page (2M) alignment */
start_pfn = PFN_DOWN(pos);
start_pfn = pfn;
end_pfn = PFN_DOWN(end);
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);

Expand Down

0 comments on commit 979d144

Please sign in to comment.