diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2015-09-09 18:35:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 16:29:01 -0400 |
commit | d3691d2c6d3e72624c987bbef6f322631bbb2d5d (patch) | |
tree | f87defd1e939131c6c46ab826ec0f901f59cbc95 /fs/proc | |
parent | f074a8f49eb87cde95ac9d040ad5e7ea4f029738 (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 <vdavydov@parallels.com>
Suggested-by: Andres Lagar-Cavilla <andreslc@google.com>
Reviewed-by: Andres Lagar-Cavilla <andreslc@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Greg Thelen <gthelen@google.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/page.c | 6 |
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, | |||
58 | pfn++; | 58 | pfn++; |
59 | out++; | 59 | out++; |
60 | count -= KPMSIZE; | 60 | count -= KPMSIZE; |
61 | |||
62 | cond_resched(); | ||
61 | } | 63 | } |
62 | 64 | ||
63 | *ppos += (char __user *)out - buf; | 65 | *ppos += (char __user *)out - buf; |
@@ -219,6 +221,8 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, | |||
219 | pfn++; | 221 | pfn++; |
220 | out++; | 222 | out++; |
221 | count -= KPMSIZE; | 223 | count -= KPMSIZE; |
224 | |||
225 | cond_resched(); | ||
222 | } | 226 | } |
223 | 227 | ||
224 | *ppos += (char __user *)out - buf; | 228 | *ppos += (char __user *)out - buf; |
@@ -267,6 +271,8 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf, | |||
267 | pfn++; | 271 | pfn++; |
268 | out++; | 272 | out++; |
269 | count -= KPMSIZE; | 273 | count -= KPMSIZE; |
274 | |||
275 | cond_resched(); | ||
270 | } | 276 | } |
271 | 277 | ||
272 | *ppos += (char __user *)out - buf; | 278 | *ppos += (char __user *)out - buf; |