Re: ipv6_addr_cmp performance patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Craig, Dave wrote:

Please consider the attached patch for incorporation into the next Linux
2.6 release.  I found that using the __builtin_memcmp GCC intrinsic for
doing IPv6 address comparison a lot more slow than integer comparison.
In significant SCTP workloads I found address comparison taking roughly
10% of the CPU time.  After changing the address comparison to an
integer-based approach the comparison consumed 5% of the CPU time.

This is what IN6_ARE_ADDR_EQUAL() does in netinet/in.h in user-space.

I also microbenchmarked the comparison on my architecture, a Pentium 4,
and found the integer comparison was over 3x faster than the string
comparison.  The microbenchmark consisted of a series of address
comparisons where 20% matched and 80% that didn't match.  I looked at
addresses that differed in the first, last, and random byte.

How does performance compare on a 64-bit architecture? If you send me a pointer I can at least try IA64, maybe Opteron.


Maybe a more general question is why none of the macros/inlines have optimized 64-bit versions, which would make this 2 integer compares. There must be a reason the below isn't defined?

struct in6_addr
{
        union
        {
                __u8            u6_addr8[16];
                __u16           u6_addr16[8];
                __u32           u6_addr32[4];
+		__u64		u6_addr64[2];
        } in6_u;
#define s6_addr                 in6_u.u6_addr8
#define s6_addr16               in6_u.u6_addr16
#define s6_addr32               in6_u.u6_addr32
+#defind s6_addr64		in6_u.u6_addr64
};

-Brian

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux