aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Davydov <[email protected]>2015-09-09 15:35:51 -0700
committerLinus Torvalds <[email protected]>2015-09-10 13:29:01 -0700
commitd3691d2c6d3e72624c987bbef6f322631bbb2d5d (patch)
treef87defd1e939131c6c46ab826ec0f901f59cbc95
parentf074a8f49eb87cde95ac9d040ad5e7ea4f029738 (diff)
proc: add cond_resched to /proc/kpage* read/write loop
Reading/writing a /proc/kpage* file may take long on machines with a lot of RAM installed. Signed-off-by: Vladimir Davydov <[email protected]> Suggested-by: Andres Lagar-Cavilla <[email protected]> Reviewed-by: Andres Lagar-Cavilla <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Raghavendra K T <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Greg Thelen <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: David Rientjes <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Cc: Jonathan Corbet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--fs/proc/page.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/proc/page.c b/fs/proc/page.c
index 0b8286450a93..93484034a03d 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -58,6 +58,8 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
pfn++;
out++;
count -= KPMSIZE;
+
+ cond_resched();
}
*ppos += (char __user *)out - buf;
@@ -219,6 +221,8 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
pfn++;
out++;
count -= KPMSIZE;
+
+ cond_resched();
}
*ppos += (char __user *)out - buf;
@@ -267,6 +271,8 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf,
pfn++;
out++;
count -= KPMSIZE;
+
+ cond_resched();
}
*ppos += (char __user *)out - buf;