From: Shirley Ma <mashirle@us.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Avi Kivity <avi@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>,
netdev@vger.kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net
Date: Mon, 23 Nov 2009 08:18:08 -0800 [thread overview]
Message-ID: <1258993088.5022.30.camel@localhost.localdomain> (raw)
In-Reply-To: <20091123094323.GA3748@redhat.com>
On Mon, 2009-11-23 at 11:43 +0200, Michael S. Tsirkin wrote:
> should be !npage->private
> and nesting is too deep here:
> this is cleaner in a give_a_page subroutine
> as it was.
This will be addressed with Rusty's comment.
> > + /* use private to chain big packets */
>
> packets? or pages?
Will change it to chain pages for big packets
> > + p->private = (unsigned long)0;
>
> the comment is not really helpful:
> you say you use private to chain but 0 does not
> chain anything. You also do not need the cast to long?
Ok.
> > + if (len > (PAGE_SIZE - f->page_offset))
>
> brackets around math are not needed.
OK.
> typo
>
> > + * header and data */
Got it.
> please think of a way to get rid of magic constants like 6 and 2
> here and elsewhere.
Will do.
> replace MAX_SKB_FRAGS + 2 with something symbolic? We have it in 2 palces now.
> And comment.
Ok, I can change it.
> terrible goto based loop
> move stuff into subfunction, it will be much
> more manageable, and convert this to a simple
> for loop.
Will change it to different functions based on Rusty's comment.
> and here it is MAX_SKB_FRAGS + 1
I think I should use MAX_SKB_FRAGS + 2 instead. Now I only use
MAX_SKB_FRAGS + 1 but allocated + 2.
> > + page->private = (unsigned long)first_page;
> > + first_page = page;
> > + if (--i == 1) {
>
> this is pretty hairy ... has to be this way?
> What you are trying to do here
> is fill buffer with pages, in a loop, with first one
> using a partial page, and then add it.
> Is that it?
Yes.
> So please code this in a straight forward manner.
> it should be as simple as:
> offset = XXX
> for (i = 0; i < MAX_SKB_FRAGS + 2; ++i) {
>
> sg_set_buf(sg + i, p + offset, PAGE_SIZE - offset);
> offset = 0;
>
> }
Ok, looks more neat.
> space around +
> sg + 1 here is same as &sg[i] in fact?
Ok.
> callback -> destructor?
Ok.
I will integrate these comments with Rusty's and resubmit the patch set.
Thanks
Shirley
prev parent reply other threads:[~2009-11-23 16:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-20 6:15 [PATCH 1/1] Defer skb allocation for both mergeable buffers and big packets in virtio_net Shirley Ma
2009-11-20 6:19 ` Eric Dumazet
2009-11-20 16:08 ` Shirley Ma
2009-11-20 16:21 ` Shirley Ma
2009-11-23 1:08 ` Rusty Russell
2009-11-23 16:07 ` Shirley Ma
2009-11-23 22:24 ` Rusty Russell
2009-11-23 23:27 ` Shirley Ma
2009-11-24 11:37 ` Michael S. Tsirkin
2009-11-24 14:36 ` Anthony Liguori
2009-11-24 16:04 ` Michael S. Tsirkin
2009-11-24 16:04 ` Michael S. Tsirkin
2009-11-25 0:15 ` Rusty Russell
2009-11-25 0:12 ` Rusty Russell
2009-11-25 9:15 ` Michael S. Tsirkin
2009-11-25 10:20 ` Rusty Russell
2009-11-25 11:40 ` Michael S. Tsirkin
2009-11-23 19:01 ` Shirley Ma
2009-11-23 9:43 ` Michael S. Tsirkin
2009-11-23 16:18 ` Shirley Ma [this message]
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=1258993088.5022.30.camel@localhost.localdomain \
--to=mashirle@us.ibm.com \
--cc=avi@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
/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).