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

From: Gioh Kim
Date: Fri Jul 04 2014 - 03:53:22 EST


When CMA try to migrate page, some buffer-heads can exist on lru.
The bh on lru has non-zero count value so that it cannot be dropped
even-if it is not used. We can drop only buffers related to the
migrated page, but it can take long time more than dropping all
because of searching list. There all buffers in lru are dropped.

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

diff --git a/fs/buffer.c b/fs/buffer.c
index eba6e4f..4f11b7a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3233,6 +3233,19 @@ int try_to_free_buffers(struct page *page)
if (PageWriteback(page))
return 0;

+#ifdef CONFIG_CMA
+ /*
+ * When CMA try to migrate page, some buffer-heads can exist on lru.
+ * The bh on lru has non-zero count value so that it cannot
+ * be dropped even-if it is not used.
+ * We can drop only buffers related to the migrated page,
+ * but it can take long time more than dropping all
+ * because of searching list.
+ * There all buffers in lru are dropped first.
+ */
+ invalidate_bh_lrus();
+#endif
+
if (mapping == NULL) { /* can this still happen? */
ret = drop_buffers(page, &buffers_to_free);
goto out;
--
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/