Skip to content
Snippets Groups Projects
Commit c05cf5c3 authored by Guillaume Tucker's avatar Guillaume Tucker
Browse files

WIP potential fix from Mike Rapoport <rppt@linux.ibm.com>

parent 4f0b547b
No related tags found
No related merge requests found
...@@ -58,7 +58,8 @@ module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400); ...@@ -58,7 +58,8 @@ module_param_call(shuffle, shuffle_store, shuffle_show, &shuffle_param, 0400);
* For two pages to be swapped in the shuffle, they must be free (on a * For two pages to be swapped in the shuffle, they must be free (on a
* 'free_area' lru), have the same order, and have the same migratetype. * 'free_area' lru), have the same order, and have the same migratetype.
*/ */
static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order) static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order,
struct zone *z)
{ {
struct page *page; struct page *page;
...@@ -80,6 +81,9 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order) ...@@ -80,6 +81,9 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order)
if (!PageBuddy(page)) if (!PageBuddy(page))
return NULL; return NULL;
if (!memmap_valid_within(pfn, page, z))
return NULL;
/* /*
* ...is the page on the same list as the page we will * ...is the page on the same list as the page we will
* shuffle it with? * shuffle it with?
...@@ -123,7 +127,7 @@ void __meminit __shuffle_zone(struct zone *z) ...@@ -123,7 +127,7 @@ void __meminit __shuffle_zone(struct zone *z)
* page_j randomly selected in the span @zone_start_pfn to * page_j randomly selected in the span @zone_start_pfn to
* @spanned_pages. * @spanned_pages.
*/ */
page_i = shuffle_valid_page(i, order); page_i = shuffle_valid_page(i, order, z);
if (!page_i) if (!page_i)
continue; continue;
...@@ -137,7 +141,7 @@ void __meminit __shuffle_zone(struct zone *z) ...@@ -137,7 +141,7 @@ void __meminit __shuffle_zone(struct zone *z)
j = z->zone_start_pfn + j = z->zone_start_pfn +
ALIGN_DOWN(get_random_long() % z->spanned_pages, ALIGN_DOWN(get_random_long() % z->spanned_pages,
order_pages); order_pages);
page_j = shuffle_valid_page(j, order); page_j = shuffle_valid_page(j, order, z);
if (page_j && page_j != page_i) if (page_j && page_j != page_i)
break; break;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment