lkml.org 
[lkml]   [2013]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mm: call cond_resched() per MAX_ORDER_NR_PAGES pages copy
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@ah.jp.nec.com>
---
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


\
 
 \ /
  Last update: 2013-11-18 21:01    [W:3.424 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site