Skip to content

Commit 9618fba

Browse files
Eric Dumazetgregkh
Eric Dumazet
authored andcommitted
proc: add a schedule point in proc_pid_readdir()
[ Upstream commit 3ba4bce ] We have seen proc_pid_readdir() invocations holding cpu for more than 50 ms. Add a cond_resched() to be gentle with other tasks. [[email protected]: coding style fix] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e23b1c0 commit 9618fba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/proc/base.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3181,6 +3181,8 @@ int proc_pid_readdir(struct file *file, struct dir_context *ctx)
31813181
iter.tgid += 1, iter = next_tgid(ns, iter)) {
31823182
char name[PROC_NUMBUF];
31833183
int len;
3184+
3185+
cond_resched();
31843186
if (!has_pid_permissions(ns, iter.task, 2))
31853187
continue;
31863188

0 commit comments

Comments
 (0)