Commit 57cbc87e authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Linus Torvalds

mm/debug-pagealloc: correct freepage accounting and order resetting

One thing I did in this patch is fixing freepage accounting.  If we
clear guard page and link it onto isolate buddy list, we should not
increase freepage count.  This patch adds conditional branch to skip
counting in this case.  Without this patch, this overcounting happens
frequently if guard order is set and CMA is used.

Another thing fixed in this patch is the target to reset order.  In
__free_one_page(), we check the buddy page whether it is a guard page or
not.  And, if so, we should clear guard attribute on the buddy page and
reset order of it to 0.  But, current code resets original page's order
rather than buddy one's.  Maybe, this doesn't have any problem, because
whole merged page's order will be re-assigned soon.  But, it is better
to correct code.
Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: default avatarVlastimil Babka <vbabka@suse.cz>
Cc: Gioh Kim <gioh.kim@lge.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8edc6e16
...@@ -583,9 +583,11 @@ static inline void __free_one_page(struct page *page, ...@@ -583,9 +583,11 @@ static inline void __free_one_page(struct page *page,
*/ */
if (page_is_guard(buddy)) { if (page_is_guard(buddy)) {
clear_page_guard_flag(buddy); clear_page_guard_flag(buddy);
set_page_private(page, 0); set_page_private(buddy, 0);
__mod_zone_freepage_state(zone, 1 << order, if (!is_migrate_isolate(migratetype)) {
migratetype); __mod_zone_freepage_state(zone, 1 << order,
migratetype);
}
} else { } else {
list_del(&buddy->lru); list_del(&buddy->lru);
zone->free_area[order].nr_free--; zone->free_area[order].nr_free--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment