mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] epoll: add a reschedule point in ep_free()
@ 2013-08-17 15:06 Eric Dumazet
  2013-08-27 23:33 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2013-08-17 15:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Al Viro, edumazet, Theodore Ts'o

From: Eric Dumazet <edumazet@google.com>

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>
---
Google-Bug-Id: 8940884

 fs/eventpoll.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 9ad17b15..4ff595d 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);
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] epoll: add a reschedule point in ep_free()
  2013-08-17 15:06 [PATCH] epoll: add a reschedule point in ep_free() Eric Dumazet
@ 2013-08-27 23:33 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2013-08-27 23:33 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Andrew Morton, linux-kernel, Al Viro, edumazet, Theodore Ts'o

Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Seems reasonable.  This isn't a remotely hot path and f_op->release
runs in a workqueue nowadays (right?).

Acked-by: Eric Wong <normalperson@yhbt.net>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-27 23:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-17 15:06 [PATCH] epoll: add a reschedule point in ep_free() Eric Dumazet
2013-08-27 23:33 ` Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®