aboutsummaryrefslogtreecommitdiffstats
path: root/fs/eventpoll.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-09-11 17:24:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-11 18:58:50 -0400
commit91cf5ab60ff82ecf4550a596867787c1e360dd3f (patch)
treebcfba2f74873abc7c59fc2d3c4e5ae27ad4386f7 /fs/eventpoll.c
parent8716de383b82f16d920513138f1691e40ef5a9e3 (diff)
epoll: add a reschedule point in ep_free()
ep_free() might iterate on a huge set of epitems and hold cpu too long. Add two cond_resched() in order to yield cpu to other tasks. This is safe as we only hold mutexes in this function. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Theodore Ts'o <tytso@mit.edu> Acked-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r--fs/eventpoll.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 293f86741ddb..473e09da7d02 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -740,6 +740,7 @@ static void ep_free(struct eventpoll *ep)
740 epi = rb_entry(rbp, struct epitem, rbn); 740 epi = rb_entry(rbp, struct epitem, rbn);
741 741
742 ep_unregister_pollwait(ep, epi); 742 ep_unregister_pollwait(ep, epi);
743 cond_resched();
743 } 744 }
744 745
745 /* 746 /*
@@ -754,6 +755,7 @@ static void ep_free(struct eventpoll *ep)
754 while ((rbp = rb_first(&ep->rbr)) != NULL) { 755 while ((rbp = rb_first(&ep->rbr)) != NULL) {
755 epi = rb_entry(rbp, struct epitem, rbn); 756 epi = rb_entry(rbp, struct epitem, rbn);
756 ep_remove(ep, epi); 757 ep_remove(ep, epi);
758 cond_resched();
757 } 759 }
758 mutex_unlock(&ep->mtx); 760 mutex_unlock(&ep->mtx);
759 761