On Fri, Oct 31, 2014 at 03:39:13PM +0100, Vlastimil Babka wrote:
+ __isolate_free_page(page, order);
+ set_page_refcounted(page);
+ isolated_page = page;
+ }
+ }
+ }
nr_pages = move_freepages_block(zone, page, migratetype);
- this is a costly no-op when the whole pageblock is an isolated
page, right?
Okay. I will fix it.
__mod_zone_freepage_state(zone, nr_pages, migratetype);
- with isolated_page set, this means you increase freepage_state
here, and then the second time in __free_pages() below?
__isolate_free_page() won't decrease it as the pageblock is still
MIGRATE_ISOLATE, so the net result is overcounting?
After __isolate_free_page(), freepage has no buddy flag and
move_freepages_block() doesn't move and count it. So, freepage_state
only increase in __free_pages(). So net result will be correct.
Below is the update for your comment.
Thanks.
------------>8----------------
From 4bf298908aba16935c7699589c60d00fa0cf389c Mon Sep 17 00:00:00 2001
From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Date: Mon, 25 Aug 2014 09:52:13 +0900
Subject: [PATCH v6 4/4] mm/page_alloc: restrict max order of merging on isolated
pageblock
Current pageblock isolation logic could isolate each pageblock
individually. This causes freepage accounting problem if freepage with
pageblock order on isolate pageblock is merged with other freepage on
normal pageblock. We can prevent merging by restricting max order of
merging to pageblock order if freepage is on isolate pageblock.
Side-effect of this change is that there could be non-merged buddy
freepage even if finishing pageblock isolation, because undoing pageblock
isolation is just to move freepage from isolate buddy list to normal buddy
list rather than to consider merging. So, the patch also makes undoing
pageblock isolation consider freepage merge. When un-isolation, freepage
with more than pageblock order and it's buddy are checked. If they are
on normal pageblock, instead of just moving, we isolate the freepage and
free it in order to get merged.
Changes from v5:
Avoid costly move_freepages_block() if there is no freepage.
Some cosmetic changes.
Changes from v4:
Consider merging on un-isolation process.
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>