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>
This commit is contained in:
parent
8716de383b
commit
91cf5ab60f
|
@ -740,6 +740,7 @@ static void ep_free(struct eventpoll *ep)
|
||||||
epi = rb_entry(rbp, struct epitem, rbn);
|
epi = rb_entry(rbp, struct epitem, rbn);
|
||||||
|
|
||||||
ep_unregister_pollwait(ep, epi);
|
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) {
|
while ((rbp = rb_first(&ep->rbr)) != NULL) {
|
||||||
epi = rb_entry(rbp, struct epitem, rbn);
|
epi = rb_entry(rbp, struct epitem, rbn);
|
||||||
ep_remove(ep, epi);
|
ep_remove(ep, epi);
|
||||||
|
cond_resched();
|
||||||
}
|
}
|
||||||
mutex_unlock(&ep->mtx);
|
mutex_unlock(&ep->mtx);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue