* [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0
@ 2020-06-19 18:00 Sridhar Samudrala
0 siblings, 0 replies; 5+ messages in thread
From: Sridhar Samudrala @ 2020-06-19 18:00 UTC (permalink / raw)
To: viro, linux-fsdevel, netdev
This patch triggers 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>
---
fs/eventpoll.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 12eebcdea9c8..5f55078d6381 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1847,6 +1847,19 @@ 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 and
+ * only if sysctl.net.core.busy_poll is set to non-zero value.
+ */
+ if (!eavail) {
+ ep_busy_loop(ep, timed_out);
+ write_lock_irq(&ep->lock);
+ eavail = ep_events_available(ep);
+ write_unlock_irq(&ep->lock);
+ }
+
goto send_events;
}
--
2.25.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0
@ 2020-06-19 18:13 Sridhar Samudrala
2020-06-24 16:32 ` Samudrala, Sridhar
0 siblings, 1 reply; 5+ messages in thread
From: Sridhar Samudrala @ 2020-06-19 18:13 UTC (permalink / raw)
To: viro, linux-fsdevel, netdev
This patch triggers 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>
---
fs/eventpoll.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 12eebcdea9c8..5f55078d6381 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1847,6 +1847,19 @@ 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 and
+ * only if sysctl.net.core.busy_poll is set to non-zero value.
+ */
+ if (!eavail) {
+ ep_busy_loop(ep, timed_out);
+ write_lock_irq(&ep->lock);
+ eavail = ep_events_available(ep);
+ write_unlock_irq(&ep->lock);
+ }
+
goto send_events;
}
--
2.25.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0
2020-06-19 18:13 [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0 Sridhar Samudrala
@ 2020-06-24 16:32 ` Samudrala, Sridhar
2020-06-24 16:49 ` Eric Dumazet
0 siblings, 1 reply; 5+ messages in thread
From: Samudrala, Sridhar @ 2020-06-24 16:32 UTC (permalink / raw)
To: viro, linux-fsdevel, netdev, davem@davemloft.net, eric.dumazet
Adding Dave, Eric for review and see if we can get this in via net-next
as this is mainly useful for networking workloads doing busypoll.
Thanks
Sridhar
On 6/19/2020 11:13 AM, Sridhar Samudrala wrote:
> This patch triggers 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>
> ---
> fs/eventpoll.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index 12eebcdea9c8..5f55078d6381 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1847,6 +1847,19 @@ 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 and
> + * only if sysctl.net.core.busy_poll is set to non-zero value.
> + */
> + if (!eavail) {
> + ep_busy_loop(ep, timed_out);
> + write_lock_irq(&ep->lock);
> + eavail = ep_events_available(ep);
> + write_unlock_irq(&ep->lock);
> + }
> +
> goto send_events;
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0
2020-06-24 16:32 ` Samudrala, Sridhar
@ 2020-06-24 16:49 ` Eric Dumazet
2020-06-24 18:25 ` Samudrala, Sridhar
0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2020-06-24 16:49 UTC (permalink / raw)
To: Samudrala, Sridhar, viro, linux-fsdevel, netdev,
davem@davemloft.net, eric.dumazet
On 6/24/20 9:32 AM, Samudrala, Sridhar wrote:
> Adding Dave, Eric for review and see if we can get this in via net-next
> as this is mainly useful for networking workloads doing busypoll.
>
> Thanks
> Sridhar
>
> On 6/19/2020 11:13 AM, Sridhar Samudrala wrote:
>> This patch triggers 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>
>> ---
>> fs/eventpoll.c | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
>> index 12eebcdea9c8..5f55078d6381 100644
>> --- a/fs/eventpoll.c
>> +++ b/fs/eventpoll.c
>> @@ -1847,6 +1847,19 @@ 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 and
>> + * only if sysctl.net.core.busy_poll is set to non-zero value.
>> + */
>> + if (!eavail) {
Maybe avoid all this stuff for the typical case of busy poll being not used ?
if (!evail && 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);
>> + }
>> +
>> goto send_events;
>> }
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0
2020-06-24 16:49 ` Eric Dumazet
@ 2020-06-24 18:25 ` Samudrala, Sridhar
0 siblings, 0 replies; 5+ messages in thread
From: Samudrala, Sridhar @ 2020-06-24 18:25 UTC (permalink / raw)
To: Eric Dumazet, viro, linux-fsdevel, netdev, davem@davemloft.net
On 6/24/2020 9:49 AM, Eric Dumazet wrote:
>
>
> On 6/24/20 9:32 AM, Samudrala, Sridhar wrote:
>> Adding Dave, Eric for review and see if we can get this in via net-next
>> as this is mainly useful for networking workloads doing busypoll.
>>
>> Thanks
>> Sridhar
>>
>> On 6/19/2020 11:13 AM, Sridhar Samudrala wrote:
>>> This patch triggers 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>
>>> ---
>>> fs/eventpoll.c | 13 +++++++++++++
>>> 1 file changed, 13 insertions(+)
>>>
>>> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
>>> index 12eebcdea9c8..5f55078d6381 100644
>>> --- a/fs/eventpoll.c
>>> +++ b/fs/eventpoll.c
>>> @@ -1847,6 +1847,19 @@ 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 and
>>> + * only if sysctl.net.core.busy_poll is set to non-zero value.
>>> + */
>>> + if (!eavail) {
>
> Maybe avoid all this stuff for the typical case of busy poll being not used ?
>
> if (!evail && net_busy_loop_on)) {
Sure. will submit a v2 with this change.
>
>>> + ep_busy_loop(ep, timed_out);
>
>
>>> + write_lock_irq(&ep->lock);
>>> + eavail = ep_events_available(ep);
>>> + write_unlock_irq(&ep->lock);
>>> + }
>>> +
>>> goto send_events;
>>> }
>>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-24 18:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-19 18:13 [PATCH] fs/epoll: Enable non-blocking busypoll with epoll timeout of 0 Sridhar Samudrala
2020-06-24 16:32 ` Samudrala, Sridhar
2020-06-24 16:49 ` Eric Dumazet
2020-06-24 18:25 ` Samudrala, Sridhar
-- strict thread matches above, loose matches on Subject: below --
2020-06-19 18:00 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).