[PATCH 10/10] mm/page_alloc: Stop merging pages on non-isolate and isolate buddy list

From: Joonsoo Kim
Date: Fri Jul 04 2014 - 03:53:57 EST


If we merge pages on non-isolate buddy list and isolate buddy list,
respectively, we should fixup freepage count, because we don't regard
pages in isolate buddy list as freepage. But this will impose some
overhead on __free_one_page() which is core function of page free path
so this overhead looks undesirable to me. Instead, we can stop merging
in this case. With this approach, we can skip to fixup freepage count
with low overhead.

The side-effect of this change is that some buddies equal or larger than
pageblock order isn't merged if one of buddy is on isolate pageblock. But,
I think that this is no problem, because isolation means that we will use
page on isolate pageblock specially, so it will split soon in any case.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
---
mm/page_alloc.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 80c9bd8..da4da66 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -648,6 +648,24 @@ static inline void __free_one_page(struct page *page,
break;

/*
+ * Stop merging between page on non-isolate buddy list and
+ * isolate buddy list, respectively. This case is only possible
+ * for pages equal or larger than pageblock_order, because
+ * pageblock migratetype can be changed in this granularity.
+ */
+ if (unlikely(order >= pageblock_order &&
+ has_isolate_pageblock(zone))) {
+ int buddy_mt = get_onbuddy_migratetype(buddy);
+
+ if (migratetype != buddy_mt) {
+ if (is_migrate_isolate(migratetype))
+ break;
+ else if (is_migrate_isolate(buddy_mt))
+ break;
+ }
+ }
+
+ /*
* Our buddy is free or it is CONFIG_DEBUG_PAGEALLOC guard page,
* merge with it and move up one order.
*/
--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/