Re: [RFC] csum experts, csum_replace2() is too expensive

From: Eric Dumazet
Date: Fri Mar 21 2014 - 09:33:18 EST


On Fri, 2014-03-21 at 05:50 -0700, Eric Dumazet wrote:

> Or the fact that we mix 16 bit stores and 32bit loads ?
>
> iph->tot_len = newlen;
> iph->check = 0;
> iph->check = ip_fast_csum(iph, 5);

Yep definitely. Using 16 bit loads in ip_fast_csum() totally removes the
stall. I no longer see inet_gro_complete() in perf top...

+ if (__builtin_constant_p(ihl) && ihl == 5) {
+ asm(" movw (%[iph]), %w[sum]\n" /* ihl/version/tos */
+ " addw 2(%[iph]), %w[sum]\n" /* tot_len */
+ " adcw 8(%[iph]), %w[sum]\n" /* ttl/protocol */
+ " adcw 10(%[iph]), %w[sum]\n" /* check */
+ " adcl 4(%[iph]), %[sum]\n" /* id/frag_off */
+ " adcl 12(%[iph]), %[sum]\n" /* saddr */
+ " adcl 16(%[iph]), %[sum]\n" /* daddr */
+ " adcl $0, %[sum]\n"
+ : [sum] "=r" (sum)
+ : [iph] "r" (iph)
+ );
+ return csum_fold(sum);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/