From: Rusty Russell <rusty@rustcorp.com.au>
To: dor.laor@qumranet.com
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
netdev@vger.kernel.org,
virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [virtio-net][PATCH] Don't arm tx hrtimer with a constant 500us each transmit
Date: Tue, 18 Dec 2007 11:01:12 +1100 [thread overview]
Message-ID: <200712181101.14916.rusty@rustcorp.com.au> (raw)
In-Reply-To: <475FD9E8.1060109@qumranet.com>
On Wednesday 12 December 2007 23:54:00 Dor Laor wrote:
> commit 763769621d271d92204ed27552d75448587c1ac0
> Author: Dor Laor <dor.laor@qumranet.com>
> Date: Wed Dec 12 14:52:00 2007 +0200
>
> [virtio-net][PATCH] Don't arm tx hrtimer with a constant 50us each
> transmit
>
> The current start_xmit sets 500us hrtimer to kick the host.
> The problem is that if another xmit happens before the timer was
> fired then
> the first xmit will have to wait additional 500us.
> This patch does not re-arm the timer if there is existing one.
> This will shorten the latency for tx.
Hi Dor!
Yes, I pondered this when I wrote the code. On the one hand, it's a
low-probability pathological corner case, on the other, your patch reduces
the number of timer reprograms in the normal case.
So I've applied it, thanks!
Rusty.
>
> Signed-off-by: Dor Laor <dor.laor@qumranet.com>
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 7b051d5..8bb17d1
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -406,10 +405,10 @@ again:
> virtio_debug(vdebug, "%s: before calling kick %d\n",
> __FUNCTION__, __LINE__);
> vi->svq->vq_ops->kick(vi->svq);
> vi->out_num = 0;
> - } else {
> - vi->stats.hrtimer_starts++;
> - hrtimer_start(&vi->tx_timer, ktime_set(0,500000),
> - HRTIMER_MODE_REL);
> + } else if (!hrtimer_is_queued(&vi->tx_timer)) {
> + vi->stats.hrtimer_starts++;
> + hrtimer_start(&vi->tx_timer, ktime_set(0,500000),
> + HRTIMER_MODE_REL);
> }
> return 0;
> }
next prev parent reply other threads:[~2007-12-18 0:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-12 12:54 [virtio-net][PATCH] Don't arm tx hrtimer with a constant 500us each transmit Dor Laor
2007-12-12 13:19 ` [kvm-devel] " Christian Borntraeger
2007-12-12 14:17 ` Dor Laor
2007-12-12 16:33 ` Christian Borntraeger
[not found] ` <200712121733.07804.borntraeger-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-12-13 8:44 ` Dor Laor
[not found] ` <4760F0EA.7010004-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-14 17:19 ` Cam Macdonell
[not found] ` <4762BB1A.4020905-edFDblaTWIyXbbII50Afww@public.gmane.org>
2007-12-16 10:13 ` Dor Laor
[not found] ` <4764FA5E.3070104-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-17 20:40 ` Cam Macdonell
[not found] ` <4766DEB2.5050601-edFDblaTWIyXbbII50Afww@public.gmane.org>
2007-12-18 12:50 ` Dor Laor
2007-12-18 18:42 ` Cam Macdonell
[not found] ` <47681499.8080205-edFDblaTWIyXbbII50Afww@public.gmane.org>
2007-12-18 23:38 ` Cam Macdonell
[not found] ` <476859DE.80208-edFDblaTWIyXbbII50Afww@public.gmane.org>
2007-12-19 8:25 ` Dor Laor
2007-12-13 8:44 ` [kvm-devel] " Dor Laor
2007-12-12 16:33 ` Christian Borntraeger
2007-12-12 14:17 ` Dor Laor
2007-12-12 13:19 ` Christian Borntraeger
2007-12-18 0:01 ` Rusty Russell [this message]
2007-12-18 5:30 ` Avi Kivity
[not found] ` <200712181101.14916.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2007-12-18 5:30 ` Avi Kivity
2007-12-18 7:24 ` [kvm-devel] " Rusty Russell
[not found] ` <47675AE0.8050808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-18 7:24 ` Rusty Russell
2007-12-18 12:55 ` Dor Laor
2007-12-18 12:55 ` Dor Laor
2007-12-18 0:01 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2007-12-12 12:54 Dor Laor
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=200712181101.14916.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=dor.laor@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.