From: Amit Shah <amit.shah@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_net: Check for room in the vq before adding buffer
Date: Thu, 27 Aug 2009 15:59:06 +0530 [thread overview]
Message-ID: <20090827102906.GA10885@amit-x200.redhat.com> (raw)
In-Reply-To: <200908271917.21260.rusty@rustcorp.com.au>
On (Thu) Aug 27 2009 [19:17:20], Rusty Russell wrote:
> On Wed, 26 Aug 2009 06:58:28 pm Amit Shah wrote:
> > Saves us one cycle of alloc-add-free if the queue was full.
> >
> > Signed-off-by: Amit Shah <amit.shah@redhat.com>
>
> Thanks, applied with one change:
>
> > @@ -323,7 +323,7 @@ static bool try_fill_recv_maxbufs(struct virtnet_info *vi, gfp_t gfp)
> > break;
> > }
> > vi->num++;
> > - }
> > + } while (err > 0);
>
> This is better as "while (err >= num)". The other one is right (we only need
> 1 buffer), this one we need to be able to fit "num" entries.
I'm missing something though: the value of 'num' changes in the loop and
the value of num when it will be compared will just have been used by
add_buf. The next iteration of the loop will probably use a different
value (-- from just reading the code, not going over the cases in which
this function is called).
Amit
next prev parent reply other threads:[~2009-08-27 10:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-26 9:28 [PATCH] virtio_net: Check for room in the vq before adding buffer Amit Shah
2009-08-27 9:47 ` Rusty Russell
2009-08-27 10:29 ` Amit Shah [this message]
2009-08-27 11:06 ` Rusty Russell
2009-08-27 11:18 ` Amit Shah
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=20090827102906.GA10885@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=rusty@rustcorp.com.au \
--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 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).