lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291976864.3580.7.camel@edumazet-laptop>
Date:	Fri, 10 Dec 2010 11:27:44 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Shirley Ma <mashirle@...ibm.com>
Cc:	Avi Kivity <avi@...hat.com>, Arnd Bergmann <arnd@...db.de>,
	mst@...hat.com, xiaohui.xin@...el.com, netdev@...r.kernel.org,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH V2 5/5] Add TX zero copy in macvtap

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) {
	...
}


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ