From: Eric Dumazet Date: Tue, 24 Jan 2017 23:18:07 +0000 (-0800) Subject: proc: add a schedule point in proc_pid_readdir() X-Git-Tag: archive/raspbian/4.9.30-2+deb9u2+rpi1~4^2~385 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b451ea8b477a43a46686ab313610072832c61fd6;p=linux-4.9.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/proc/base.c b/fs/proc/base.c index 0e8551a44ad4..c83180c14f38 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3181,6 +3181,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;