Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3] fs/epoll: Enable non-blocking busypoll when epoll timeout is 0
@ 2020-07-10 4:51 Sridhar Samudrala
0 siblings, 0 replies; only message in thread
From: Sridhar Samudrala @ 2020-07-10 4:51 UTC (permalink / raw)
To: linux-fsdevel, netdev, eric.dumazet, davem, alexander.h.duyck
Trigger non-blocking busy poll when busy_poll is enabled and
epoll is called with a timeout of 0 and is associated with a
napi_id. This enables an app thread to go through napi poll
routine once by calling epoll with a 0 timeout.
poll/select with a 0 timeout behave in a similar manner.
Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
v3: reset napi_id if no event available after busy poll (Alex)
v2: Added net_busy_loop_on() check (Eric)
---
fs/eventpoll.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 12eebcdea9c8..b035b5cd19ce 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1847,6 +1847,22 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
eavail = ep_events_available(ep);
write_unlock_irq(&ep->lock);
+ /*
+ * Trigger non-blocking busy poll if timeout is 0 and there are
+ * no events available. Passing timed_out(1) to ep_busy_loop
+ * will make sure that busy polling is triggered only once.
+ */
+ if (!eavail && net_busy_loop_on()) {
+ ep_busy_loop(ep, timed_out);
+
+ write_lock_irq(&ep->lock);
+ eavail = ep_events_available(ep);
+ write_unlock_irq(&ep->lock);
+
+ if (!evail)
+ ep_reset_busy_poll_napi_id(ep);
+ }
+
goto send_events;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-10 4:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 4:51 [PATCH v3] fs/epoll: Enable non-blocking busypoll when epoll timeout is 0 Sridhar Samudrala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).