From: Jason Wang <jasowang@redhat.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org, wexu@redhat.com,
kvm@vger.kernel.org, mst@redhat.com
Subject: Re: [PATCH net-next V3 3/3] tun: rx batching
Date: Tue, 3 Jan 2017 11:12:22 +0800 [thread overview]
Message-ID: <47860492-d254-86b5-c36c-29b51b0c00ab@redhat.com> (raw)
In-Reply-To: <20161231.123147.1116351209865273335.davem@davemloft.net>
On 2017年01月01日 01:31, David Miller wrote:
> From: Jason Wang <jasowang@redhat.com>
> Date: Fri, 30 Dec 2016 13:20:51 +0800
>
>> @@ -1283,10 +1314,15 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
>> skb_probe_transport_header(skb, 0);
>>
>> rxhash = skb_get_hash(skb);
>> +
>> #ifndef CONFIG_4KSTACKS
>> - local_bh_disable();
>> - netif_receive_skb(skb);
>> - local_bh_enable();
>> + if (!rx_batched) {
>> + local_bh_disable();
>> + netif_receive_skb(skb);
>> + local_bh_enable();
>> + } else {
>> + tun_rx_batched(tfile, skb, more);
>> + }
>> #else
>> netif_rx_ni(skb);
>> #endif
> If rx_batched has been set, and we are talking to clients not using
> this new MSG_MORE facility (or such clients don't have multiple TX
> packets to send to you, thus MSG_MORE is often clear), you are doing a
> lot more work per-packet than the existing code.
>
> You take the queue lock, you test state, you splice into a local queue
> on the stack, then you walk that local stack queue to submit just one
> SKB to netif_receive_skb().
>
> I think you want to streamline this sequence in such cases so that the
> cost before and after is similar if not equivalent.
Yes, so I will do a skb_queue_empty() check if !MSG_MORE and call
netif_receive_skb() immediately in this case. This can save the wasted
efforts.
Thanks
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2017-01-03 3:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1483075251-6889-1-git-send-email-jasowang@redhat.com>
2016-12-30 5:20 ` [PATCH net-next V3 1/3] vhost: better detection of available buffers Jason Wang
2016-12-30 5:20 ` [PATCH net-next V3 2/3] vhost_net: tx batching Jason Wang
2016-12-30 5:20 ` [PATCH net-next V3 3/3] tun: rx batching Jason Wang
[not found] ` <1483075251-6889-4-git-send-email-jasowang@redhat.com>
2016-12-31 17:31 ` David Miller
2017-01-03 3:12 ` Jason Wang [this message]
2016-12-31 21:03 ` Stephen Hemminger
2017-01-03 3:18 ` Jason Wang
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=47860492-d254-86b5-c36c-29b51b0c00ab@redhat.com \
--to=jasowang@redhat.com \
--cc=davem@davemloft.net \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=wexu@redhat.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).