mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-13 01:08:50 +00:00
x86, mm: use limit_pfn for end pfn
instead of shifting end to get that. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Link: http://lkml.kernel.org/r/1353123563-3103-39-git-send-email-yinghai@kernel.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
1829ae9ad7
commit
2e8059edb6
@ -203,10 +203,12 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
unsigned long start,
|
unsigned long start,
|
||||||
unsigned long end)
|
unsigned long end)
|
||||||
{
|
{
|
||||||
unsigned long start_pfn, end_pfn;
|
unsigned long start_pfn, end_pfn, limit_pfn;
|
||||||
unsigned long pfn;
|
unsigned long pfn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
limit_pfn = PFN_DOWN(end);
|
||||||
|
|
||||||
/* head if not big page alignment ? */
|
/* head if not big page alignment ? */
|
||||||
pfn = start_pfn = PFN_DOWN(start);
|
pfn = start_pfn = PFN_DOWN(start);
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
@ -223,8 +225,8 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
#else /* CONFIG_X86_64 */
|
#else /* CONFIG_X86_64 */
|
||||||
end_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
end_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
||||||
#endif
|
#endif
|
||||||
if (end_pfn > PFN_DOWN(end))
|
if (end_pfn > limit_pfn)
|
||||||
end_pfn = PFN_DOWN(end);
|
end_pfn = limit_pfn;
|
||||||
if (start_pfn < end_pfn) {
|
if (start_pfn < end_pfn) {
|
||||||
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
|
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
|
||||||
pfn = end_pfn;
|
pfn = end_pfn;
|
||||||
@ -233,11 +235,11 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
/* big page (2M) range */
|
/* big page (2M) range */
|
||||||
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
||||||
#ifdef CONFIG_X86_32
|
#ifdef CONFIG_X86_32
|
||||||
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
|
end_pfn = round_down(limit_pfn, PFN_DOWN(PMD_SIZE));
|
||||||
#else /* CONFIG_X86_64 */
|
#else /* CONFIG_X86_64 */
|
||||||
end_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
|
end_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
|
||||||
if (end_pfn > PFN_DOWN(round_down(end, PMD_SIZE)))
|
if (end_pfn > round_down(limit_pfn, PFN_DOWN(PMD_SIZE)))
|
||||||
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
|
end_pfn = round_down(limit_pfn, PFN_DOWN(PMD_SIZE));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (start_pfn < end_pfn) {
|
if (start_pfn < end_pfn) {
|
||||||
@ -249,7 +251,7 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
/* big page (1G) range */
|
/* big page (1G) range */
|
||||||
start_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
|
start_pfn = round_up(pfn, PFN_DOWN(PUD_SIZE));
|
||||||
end_pfn = PFN_DOWN(round_down(end, PUD_SIZE));
|
end_pfn = round_down(limit_pfn, PFN_DOWN(PUD_SIZE));
|
||||||
if (start_pfn < end_pfn) {
|
if (start_pfn < end_pfn) {
|
||||||
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
|
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
|
||||||
page_size_mask &
|
page_size_mask &
|
||||||
@ -259,7 +261,7 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
|
|
||||||
/* tail is not big page (1G) alignment */
|
/* tail is not big page (1G) alignment */
|
||||||
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
start_pfn = round_up(pfn, PFN_DOWN(PMD_SIZE));
|
||||||
end_pfn = PFN_DOWN(round_down(end, PMD_SIZE));
|
end_pfn = round_down(limit_pfn, PFN_DOWN(PMD_SIZE));
|
||||||
if (start_pfn < end_pfn) {
|
if (start_pfn < end_pfn) {
|
||||||
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
|
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn,
|
||||||
page_size_mask & (1<<PG_LEVEL_2M));
|
page_size_mask & (1<<PG_LEVEL_2M));
|
||||||
@ -269,7 +271,7 @@ static int __meminit split_mem_range(struct map_range *mr, int nr_range,
|
|||||||
|
|
||||||
/* tail is not big page (2M) alignment */
|
/* tail is not big page (2M) alignment */
|
||||||
start_pfn = pfn;
|
start_pfn = pfn;
|
||||||
end_pfn = PFN_DOWN(end);
|
end_pfn = limit_pfn;
|
||||||
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
|
nr_range = save_mr(mr, nr_range, start_pfn, end_pfn, 0);
|
||||||
|
|
||||||
/* try to merge same page size and continuous */
|
/* try to merge same page size and continuous */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user