[PATCH] mm: call cond_resched() per MAX_ORDER_NR_PAGES pages copy
From: Naoya Horiguchi
Date: Mon Nov 18 2013 - 13:54:34 EST
In copy_huge_page() we call cond_resched() before every single page copy.
This is an overkill because single page copy is not a heavy operation.
This patch changes this to call cond_resched() per MAX_ORDER_NR_PAGES pages.
Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
---
mm/migrate.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index cb5d152b58bc..661ff5f66591 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -454,7 +454,8 @@ static void __copy_gigantic_page(struct page *dst, struct page *src,
struct page *src_base = src;
for (i = 0; i < nr_pages; ) {
- cond_resched();
+ if (i % MAX_ORDER_NR_PAGES == 0)
+ cond_resched();
copy_highpage(dst, src);
i++;
@@ -483,10 +484,9 @@ static void copy_huge_page(struct page *dst, struct page *src)
nr_pages = hpage_nr_pages(src);
}
- for (i = 0; i < nr_pages; i++ ) {
- cond_resched();
+ cond_resched();
+ for (i = 0; i < nr_pages; i++)
copy_highpage(dst + i, src + i);
- }
}
/*
--
1.8.3.1
--
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/