summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-01-24 15:18:07 -0800
committerSasha Levin <alexander.levin@verizon.com>2017-06-25 22:02:21 -0400
commit1b98bab153c71520982c0f4d7460efc16f6b49a7 (patch)
treee15ed70942a10823d838b288e4f76ca857f927df /fs
parenta20b7cab8735f9d2752fec5971d3405e3c0634c1 (diff)
proc: add a schedule point in proc_pid_readdir()
[ Upstream commit 3ba4bceef23206349d4130ddf140819b365de7c8 ] We have seen proc_pid_readdir() invocations holding cpu for more than 50 ms. Add a cond_resched() to be gentle with other tasks. [akpm@linux-foundation.org: coding style fix] Link: http://lkml.kernel.org/r/1484238380.15816.42.camel@edumazet-glaptop3.roam.corp.google.com Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/base.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index fab32ad5d96d..d5665490563b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2880,6 +2880,8 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
iter.tgid += 1, iter = next_tgid(ns, iter)) {
char name[PROC_NUMBUF];
int len;
+
+ cond_resched();
if (!has_pid_permissions(ns, iter.task, 2))
continue;