From: Eric Dumazet Date: Wed, 11 Sep 2013 21:24:06 +0000 (-0700) Subject: epoll: add a reschedule point in ep_free() X-Git-Tag: v3.12-rc1~52^2~106 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=91cf5ab60ff82ecf4550a596867787c1e360dd3f;p=~emulex%2Finfiniband.git 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 Cc: Al Viro Cc: Theodore Ts'o Acked-by: Eric Wong Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 293f86741dd..473e09da7d0 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -740,6 +740,7 @@ static void ep_free(struct eventpoll *ep) epi = rb_entry(rbp, struct epitem, rbn); ep_unregister_pollwait(ep, epi); + cond_resched(); } /* @@ -754,6 +755,7 @@ static void ep_free(struct eventpoll *ep) while ((rbp = rb_first(&ep->rbr)) != NULL) { epi = rb_entry(rbp, struct epitem, rbn); ep_remove(ep, epi); + cond_resched(); } mutex_unlock(&ep->mtx);