netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shirley Ma <mashirle@us.ibm.com>
Cc: Avi Kivity <avi@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	mst@redhat.com, xiaohui.xin@intel.com, netdev@vger.kernel.org,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH V2 5/5] Add TX zero copy in macvtap
Date: Fri, 10 Dec 2010 11:27:44 +0100	[thread overview]
Message-ID: <1291976864.3580.7.camel@edumazet-laptop> (raw)
In-Reply-To: <1291976026.2167.49.camel@localhost.localdomain>

Le vendredi 10 décembre 2010 à 02:13 -0800, Shirley Ma a écrit :

> +		while (len) {
> +			f = &skb_shinfo(skb)->frags[i];
> +			f->page = page[i];
> +			f->page_offset = base & ~PAGE_MASK;
> +			f->size = min_t(int, len, PAGE_SIZE - f->page_offset);
> +			skb->data_len += f->size;
> +			skb->len += f->size;
> +			skb->truesize += f->size;
> +			skb_shinfo(skb)->nr_frags++;
> +			/* increase sk_wmem_alloc */
> +			atomic_add(f->size, &skb->sk->sk_wmem_alloc);
> +			base += f->size;
> +			len -= f->size;
> +			i++;
> +		}

You could make one atomic_add() outside of the loop, and factorize many
things...

atomic_add(len, &skb->sk->sk_wmem_alloc);
skb->data_len += len;
skb->len += len;
skb->truesize += len;
while (len) {
	...
}

  reply	other threads:[~2010-12-10 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-10 10:13 [RFC PATCH V2 5/5] Add TX zero copy in macvtap Shirley Ma
2010-12-10 10:27 ` Eric Dumazet [this message]
2010-12-10 16:25   ` Shirley Ma
2010-12-10 16:38     ` Shirley Ma
2010-12-10 16:55     ` Eric Dumazet

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=1291976864.3580.7.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=arnd@arndb.de \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mashirle@us.ibm.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiaohui.xin@intel.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).