Skip to contentSkip to conversation

proc: add a schedule point in proc_pid_readdir()

PATCH New [email protected] 1 participant 1 message Jan 24, 2017 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 9/26 proc: add a schedule point in proc_pid_readdir()

From: Eric Dumazet <[email protected]>
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.

---

 fs/proc/base.c |    2 ++
 1 file changed, 2 insertions(+)
fs/proc/base.c renamed from fs/proc/base.c~proc-add-a-schedule-point-in-proc_pid_readdir +2 -0
diff -puN fs/proc/base.c~proc-add-a-schedule-point-in-proc_pid_readdir 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;
 

_