Skip to content

Commit

Permalink
memory hotplug: exclude isolated page from pco page alloc
Browse files Browse the repository at this point in the history
Pages marked as isolated should not be allocated again.  If such pages
reside in pcp list, they can be allocated too, so there is a ping-pong
memory offline frees some pages to pcp list and the pages get allocated
and then memory offline frees them again, this loop will happen again and
again.

This should have no impact in normal code path, because in normal code
path, pages in pcp list aren't isolated, and below loop will break in the
first entry.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Yakui Zhao <yakui.zhao@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Shaohua Li authored and Linus Torvalds committed Sep 22, 2009
1 parent 112067f commit 6fb332f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,10 +1143,20 @@ struct page *buffered_rmqueue(struct zone *preferred_zone,

/* Allocate more to the pcp list if necessary */
if (unlikely(&page->lru == &pcp->list)) {
int get_one_page = 0;

pcp->count += rmqueue_bulk(zone, 0,
pcp->batch, &pcp->list,
migratetype, cold);
page = list_entry(pcp->list.next, struct page, lru);
list_for_each_entry(page, &pcp->list, lru) {
if (get_pageblock_migratetype(page) !=
MIGRATE_ISOLATE) {
get_one_page = 1;
break;
}
}
if (!get_one_page)
goto failed;
}

list_del(&page->lru);
Expand Down

0 comments on commit 6fb332f

Please sign in to comment.