[PATCH] CMA/HOTPLUG: clear buffer-head lru before page migration

From: Gioh Kim
Date: Fri Jul 18 2014 - 00:40:01 EST


The bh must be free to migrate a page at which bh is mapped.
The reference count of bh is increased when it is installed
into lru so that the bh of lru must be freed before migrating the page.

This frees every bh of lru. We could free only bh of migrating page.
But searching lru costs more than invalidating entire lru.

Signed-off-by: Gioh Kim <gioh.kim@xxxxxxx>
Acked-by: Laura Abbott <lauraa@xxxxxxxxxxxxxx>
---
mm/page_alloc.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b99643d4..3b474e0 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6369,6 +6369,9 @@ int alloc_contig_range(unsigned long start, unsigned long end,
if (ret)
return ret;

+ if (migratetype == MIGRATE_CMA || migratetype == MIGRATE_MOVABLE)
+ invalidate_bh_lrus();
+
ret = __alloc_contig_migrate_range(&cc, start, end);
if (ret)
goto done;
--
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/