From: Eric Dumazet <edumazet@xxxxxxxxxx> Subject: proc: add a schedule point in proc_pid_readdir() 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@xxxxxxxxxxxxxxxxxxxx: coding style fix] Link: http://lkml.kernel.org/r/1484238380.15816.42.camel@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/base.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN fs/proc/base.c~proc-add-a-schedule-point-in-proc_pid_readdir fs/proc/base.c --- a/fs/proc/base.c~proc-add-a-schedule-point-in-proc_pid_readdir +++ a/fs/proc/base.c @@ -3179,6 +3179,8 @@ int proc_pid_readdir(struct file *file, 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; _ -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html