From: Vladimir Davydov Date: Wed, 9 Sep 2015 22:35:51 +0000 (-0700) Subject: proc: add cond_resched to /proc/kpage* read/write loop X-Git-Tag: v4.3-rc1~22^2~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3691d2c6d3e72624c987bbef6f322631bbb2d5d;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-4.9-exynos9110.git 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 Suggested-by: Andres Lagar-Cavilla Reviewed-by: Andres Lagar-Cavilla Cc: Minchan Kim Cc: Raghavendra K T Cc: Johannes Weiner Cc: Michal Hocko Cc: Greg Thelen Cc: Michel Lespinasse Cc: David Rientjes Cc: Pavel Emelyanov Cc: Cyrill Gorcunov Cc: Jonathan Corbet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/page.c b/fs/proc/page.c index 0b82864..9348403 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;