From: Alexander Duyck <alexander.duyck@gmail.com>
To: Sridhar Samudrala <sridhar.samudrala@intel.com>
Cc: linux-fsdevel@vger.kernel.org, Netdev <netdev@vger.kernel.org>,
Eric Dumazet <eric.dumazet@gmail.com>,
David Miller <davem@davemloft.net>,
Alexander Duyck <alexander.h.duyck@linux.intel.com>,
andy.lavr@gmail.com
Subject: Re: [PATCH v4] fs/epoll: Enable non-blocking busypoll when epoll timeout is 0
Date: Sat, 11 Jul 2020 09:05:23 -0700 [thread overview]
Message-ID: <CAKgT0Uf_5v-CEHx24ryawu2UCpFUTLeXkcvNnqnETbhzpoO42Q@mail.gmail.com> (raw)
In-Reply-To: <1594447781-27115-1-git-send-email-sridhar.samudrala@intel.com>
On Fri, Jul 10, 2020 at 11:13 PM Sridhar Samudrala
<sridhar.samudrala@intel.com> wrote:
>
> This patch triggers non-blocking busy poll when busy_poll is enabled,
> 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>
>
> v4:
> - Fix a typo (Andy)
> 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..10da7a8e1c2b 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 (!eavail)
> + ep_reset_busy_poll_napi_id(ep);
> + }
> +
> goto send_events;
> }
>
This addresses the concern that I had.
Reviewed-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>
prev parent reply other threads:[~2020-07-11 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-11 6:09 [PATCH v4] fs/epoll: Enable non-blocking busypoll when epoll timeout is 0 Sridhar Samudrala
2020-07-11 16:05 ` Alexander Duyck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKgT0Uf_5v-CEHx24ryawu2UCpFUTLeXkcvNnqnETbhzpoO42Q@mail.gmail.com \
--to=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@linux.intel.com \
--cc=andy.lavr@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).