From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: "Karlsson, Magnus" <magnus.karlsson@intel.com>,
"Björn Töpel" <bjorn@kernel.org>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Network Development" <netdev@vger.kernel.org>,
"Jonathan Lemon" <jonathan.lemon@gmail.com>,
bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next] xsk: add test for tx_writeable to batched path
Date: Tue, 14 Dec 2021 15:29:40 +0100 [thread overview]
Message-ID: <CAJ8uoz1ioNtZyCRG2b3OH4pGh8b2CwHeXKC=M+4Xtf0OouxORw@mail.gmail.com> (raw)
In-Reply-To: <Ybip7mXZuCXYTlwn@boxer>
On Tue, Dec 14, 2021 at 3:28 PM Maciej Fijalkowski
<maciej.fijalkowski@intel.com> wrote:
>
> On Tue, Dec 14, 2021 at 11:26:47AM +0100, Magnus Karlsson wrote:
> > From: Magnus Karlsson <magnus.karlsson@intel.com>
> >
> > Add a test for the tx_writeable condition to the batched Tx processing
> > path. This test is in the skb and non-batched code paths but not in the
> > batched code path. So add it there. This test makes sure that a
> > process is not woken up until there are a sufficiently large number of
> > free entries in the Tx ring. Currently, any driver using the batched
> > interface will be woken up even if there is only one free entry,
> > impacting performance negatively.
>
> I gave this patch a shot on ice driver with the Tx batching patch that i'm
> about to send which is using the xsk_tx_peek_release_desc_batch(). I ran
> the 2 core setup with no busy poll and it turned out that this change has
> a negative impact on performance - it degrades by 5%.
>
> After a short chat with Magnus he said it's due to the touch to the global
> state of a ring that xsk_tx_writeable() is doing.
>
> So maintainers, please do not apply this yet, we'll come up with a
> solution.
>
> Also, should this be sent to bpf tree (not bpf-next) ?
It is just a performance fix, so I would say bpf-next.
> Thanks!
>
> >
> > Fixes: 3413f04141aa ("xsk: Change the tx writeable condition")
> > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > ---
> > net/xdp/xsk.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> > index 28ef3f4465ae..3772fcaa76ed 100644
> > --- a/net/xdp/xsk.c
> > +++ b/net/xdp/xsk.c
> > @@ -392,7 +392,8 @@ u32 xsk_tx_peek_release_desc_batch(struct xsk_buff_pool *pool, struct xdp_desc *
> >
> > xskq_cons_release_n(xs->tx, nb_pkts);
> > __xskq_cons_release(xs->tx);
> > - xs->sk.sk_write_space(&xs->sk);
> > + if (xsk_tx_writeable(xs))
> > + xs->sk.sk_write_space(&xs->sk);
> >
> > out:
> > rcu_read_unlock();
> >
> > base-commit: d27a662290963a1cde26cdfdbac71a546c06e94a
> > --
> > 2.29.0
> >
next prev parent reply other threads:[~2021-12-14 14:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-14 10:26 [PATCH bpf-next] xsk: add test for tx_writeable to batched path Magnus Karlsson
2021-12-14 14:27 ` Maciej Fijalkowski
2021-12-14 14:29 ` Magnus Karlsson [this message]
2021-12-14 14:35 ` Daniel Borkmann
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='CAJ8uoz1ioNtZyCRG2b3OH4pGh8b2CwHeXKC=M+4Xtf0OouxORw@mail.gmail.com' \
--to=magnus.karlsson@gmail.com \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jonathan.lemon@gmail.com \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
/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).