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, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>