Commit d3691d2c authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Linus Torvalds

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: default avatarVladimir Davydov <vdavydov@parallels.com>
Suggested-by: default avatarAndres Lagar-Cavilla <andreslc@google.com>
Reviewed-by: default avatarAndres 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f074a8f4
...@@ -58,6 +58,8 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, ...@@ -58,6 +58,8 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf,
pfn++; pfn++;
out++; out++;
count -= KPMSIZE; count -= KPMSIZE;
cond_resched();
} }
*ppos += (char __user *)out - buf; *ppos += (char __user *)out - buf;
...@@ -219,6 +221,8 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, ...@@ -219,6 +221,8 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf,
pfn++; pfn++;
out++; out++;
count -= KPMSIZE; count -= KPMSIZE;
cond_resched();
} }
*ppos += (char __user *)out - buf; *ppos += (char __user *)out - buf;
...@@ -267,6 +271,8 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf, ...@@ -267,6 +271,8 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf,
pfn++; pfn++;
out++; out++;
count -= KPMSIZE; count -= KPMSIZE;
cond_resched();
} }
*ppos += (char __user *)out - buf; *ppos += (char __user *)out - buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment