Skip to content

Commit 770c8aa

Browse files
bzolniertorvalds
authored andcommitted
mm: fix tracing in free_pcppages_bulk()
page->private gets re-used in __free_one_page() to store page order (so trace_mm_page_pcpu_drain() may print order instead of migratetype) thus migratetype value must be cached locally. Fixes regression introduced in commit a701623 ("mm: fix migratetype bug which slowed swapping"). This caused incorrect data to be attached to the mm_page_pcpu_drain trace event. [[email protected]: add comment] Cc: Marek Szyprowski <[email protected]> Cc: Michal Nazarewicz <[email protected]> Acked-by: Minchan Kim <[email protected]> Acked-by: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Acked-by: KOSAKI Motohiro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 02c6de8 commit 770c8aa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mm/page_alloc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,15 @@ static void free_pcppages_bulk(struct zone *zone, int count,
668668
batch_free = to_free;
669669

670670
do {
671+
int mt; /* migratetype of the to-be-freed page */
672+
671673
page = list_entry(list->prev, struct page, lru);
672674
/* must delete as __free_one_page list manipulates */
673675
list_del(&page->lru);
676+
mt = page_private(page);
674677
/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
675-
__free_one_page(page, zone, 0, page_private(page));
676-
trace_mm_page_pcpu_drain(page, 0, page_private(page));
678+
__free_one_page(page, zone, 0, mt);
679+
trace_mm_page_pcpu_drain(page, 0, mt);
677680
} while (--to_free && --batch_free && !list_empty(list));
678681
}
679682
__mod_zone_page_state(zone, NR_FREE_PAGES, count);

0 commit comments

Comments
 (0)