[PATCH] proc: add a schedule point in proc_pid_readdir()
From: Eric Dumazet
Date: Thu Jan 12 2017 - 11:27:01 EST
From: Eric Dumazet <edumazet@xxxxxxxxxx>
We have seen proc_pid_readdir() invocations holding cpu for more
than 50 ms. Add a cond_resched() to be gentle with other tasks.
Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx>
---
fs/proc/base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8e7e61b28f31..f204f80d397b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3179,6 +3179,7 @@ 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;