aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2012-10-08 19:32:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:22:45 -0400
commit95e3441248053fc06bbb1dbbd34409a84211619e (patch)
tree8c8312184b515826ca4343fa81b77d703d291398 /mm/page_alloc.c
parentb12c4ad14ee0232ad47c2bef404b6d42a3578332 (diff)
mm: remain migratetype in freed page
The page allocator caches the pageblock information in page->private while it is in the PCP freelists but this is overwritten with the order of the page when freed to the buddy allocator. This patch stores the migratetype of the page in the page->index field so that it is available at all times when the page remain in free_list. This patch adds a new call site in __free_pages_ok so it might be overhead a bit but it's for high order allocation. So I believe damage isn't hurt. Signed-off-by: Minchan Kim <minchan@kernel.org> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Xishi Qiu <qiuxishi@huawei.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6aa0a8e89c5d..94fd283dde98 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -729,6 +729,7 @@ static void __free_pages_ok(struct page *page, unsigned int order)
729{ 729{
730 unsigned long flags; 730 unsigned long flags;
731 int wasMlocked = __TestClearPageMlocked(page); 731 int wasMlocked = __TestClearPageMlocked(page);
732 int migratetype;
732 733
733 if (!free_pages_prepare(page, order)) 734 if (!free_pages_prepare(page, order))
734 return; 735 return;
@@ -737,8 +738,9 @@ static void __free_pages_ok(struct page *page, unsigned int order)
737 if (unlikely(wasMlocked)) 738 if (unlikely(wasMlocked))
738 free_page_mlock(page); 739 free_page_mlock(page);
739 __count_vm_events(PGFREE, 1 << order); 740 __count_vm_events(PGFREE, 1 << order);
740 free_one_page(page_zone(page), page, order, 741 migratetype = get_pageblock_migratetype(page);
741 get_pageblock_migratetype(page)); 742 set_freepage_migratetype(page, migratetype);
743 free_one_page(page_zone(page), page, order, migratetype);
742 local_irq_restore(flags); 744 local_irq_restore(flags);
743} 745}
744 746
@@ -959,6 +961,7 @@ static int move_freepages(struct zone *zone,
959 order = page_order(page); 961 order = page_order(page);
960 list_move(&page->lru, 962 list_move(&page->lru,
961 &zone->free_area[order].free_list[migratetype]); 963 &zone->free_area[order].free_list[migratetype]);
964 set_freepage_migratetype(page, migratetype);
962 page += 1 << order; 965 page += 1 << order;
963 pages_moved += 1 << order; 966 pages_moved += 1 << order;
964 } 967 }