Commit 1b98bab1 authored by Eric Dumazet's avatar Eric Dumazet Committed by Sasha Levin

proc: add a schedule point in proc_pid_readdir()

[ Upstream commit 3ba4bcee ]

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.comSigned-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent a20b7cab
...@@ -2880,6 +2880,8 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx) ...@@ -2880,6 +2880,8 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
iter.tgid += 1, iter = next_tgid(ns, iter)) { iter.tgid += 1, iter = next_tgid(ns, iter)) {
char name[PROC_NUMBUF]; char name[PROC_NUMBUF];
int len; int len;
cond_resched();
if (!has_pid_permissions(ns, iter.task, 2)) if (!has_pid_permissions(ns, iter.task, 2))
continue; continue;
......
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