From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: linux-kernel@vger.kernel.org,
John Fastabend <john.fastabend@gmail.com>,
netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [RFC PATCH v2] ptr_ring: linked list fallback
Date: Wed, 28 Feb 2018 17:43:06 +0200 [thread overview]
Message-ID: <20180228174100-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <f5c4904f-4bf1-1dc3-a57f-766a5b120d85@redhat.com>
On Wed, Feb 28, 2018 at 10:20:33PM +0800, Jason Wang wrote:
>
>
> On 2018年02月28日 22:01, Michael S. Tsirkin wrote:
> > On Wed, Feb 28, 2018 at 02:28:21PM +0800, Jason Wang wrote:
> > >
> > > On 2018年02月28日 12:09, Michael S. Tsirkin wrote:
> > > > > > Or we can add plist to a union:
> > > > > >
> > > > > >
> > > > > > struct sk_buff {
> > > > > > union {
> > > > > > struct {
> > > > > > /* These two members must be first. */
> > > > > > struct sk_buff *next;
> > > > > > struct sk_buff *prev;
> > > > > > union {
> > > > > > struct net_device *dev;
> > > > > > /* Some protocols might use this space to store information,
> > > > > > * while device pointer would be NULL.
> > > > > > * UDP receive path is one user.
> > > > > > */
> > > > > > unsigned long dev_scratch;
> > > > > > };
> > > > > > };
> > > > > > struct rb_node rbnode; /* used in netem & tcp stack */
> > > > > > + struct plist plist; /* For use with ptr_ring */
> > > > > > };
> > > > > >
> > > > > This look ok.
> > > > >
> > > > > > > For XDP, we need to embed plist in struct xdp_buff too,
> > > > > > Right - that's pretty straightforward, isn't it?
> > > > > Yes, it's not clear to me this is really needed for XDP consider the lock
> > > > > contention it brings.
> > > > >
> > > > > Thanks
> > > > The contention is only when the ring overflows into the list though.
> > > >
> > > Right, but there's usually a mismatch of speed between producer and
> > > consumer. In case of a fast producer, we may get this contention very
> > > frequently.
> > >
> > > Thanks
> > This is not true in my experiments. In my experiments, ring size of 4k
> > bytes is enough to see packet drops in single %s of cases.
> >
> > To you have workloads where rings are full most of the time?
>
> E.g using xdp_redirect to redirect packets from ixgbe to tap. In my test,
> ixgeb can produce ~8Mpps. But vhost can only consume ~3.5Mpps.
Then you are better off just using a small ring and dropping
packets early, right?
> >
> > One other nice side effect of this patch is that instead of dropping
> > packets quickly it slows down producer to match consumer speeds.
>
> In some case, producer may not want to be slowed down, e.g in devmap which
> can redirect packets into several different interfaces.
> > IOW, it can go either way in theory, we will need to test and see the effect.
> >
>
> Yes.
>
> Thanks
next prev parent reply other threads:[~2018-02-28 15:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 1:17 [RFC PATCH v2] ptr_ring: linked list fallback Michael S. Tsirkin
2018-02-26 3:15 ` Jason Wang
2018-02-26 20:34 ` Michael S. Tsirkin
2018-02-27 2:29 ` Jason Wang
2018-02-27 17:12 ` Michael S. Tsirkin
2018-02-28 3:28 ` Jason Wang
2018-02-28 3:39 ` Jason Wang
2018-02-28 4:11 ` Michael S. Tsirkin
2018-02-28 4:09 ` Michael S. Tsirkin
2018-02-28 6:28 ` Jason Wang
2018-02-28 14:01 ` Michael S. Tsirkin
2018-02-28 14:20 ` Jason Wang
2018-02-28 15:43 ` Michael S. Tsirkin [this message]
2018-03-01 6:41 ` Jason Wang
2018-02-27 17:53 ` Eric Dumazet
2018-02-27 19:35 ` Michael S. Tsirkin
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=20180228174100-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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).