CCID3 performance / checksum profiling
Quoting Andrea Bittau:
| * the most expensive thing should be checksum calculating [~25%]. I have thought about it and I think the main reason is that DCCP first assembles the packet (copy from user, add header) and checksums only after all that work has been done.
| * After checksum calculation, the profile should be flat. That is, 100000
| functions, each taking 0.1%.
There used to be a similar situation in UDP, until people checksummed and copied at the same time (see Partridge/Pink "A faster UDP", TON 1993).
The kernel has csum_partial_copy_fromiovecend() which is used e.g. by ip_generic_frag. The challenge/difficulty of using this function with partial checksums is in telling it to
* copy `len' bytes from user
* checksum cscov <= len bytes
(i.e. continue copying, but stop checksumming after cscov bytes)
* it leaves the checksum in skb->csum as before
If someone can find a way of adding this, including respecting 4-byte boundaries, it may improve performance by some degree. In this case, I would like to hear about that, since a similar case arises in UDP-Lite (RFC 3828).
Using partial checksums may give performance close to the copy_and_checksum case, since in the extreme case only the header is checksummed - and this has to be done irrespective of which copy function is used.
| Regarding checksums, have a look at: | http://darkircop.org/check.png
This is very interesting to see but I could not tell what the axes were for - do higher numbers mean better relative performance or the other way around?
Quoted 2 lines · Gerrit Renker
There used to be a similar situation in UDP, until people checksummed and copied at the same time (see Partridge/Pink "A faster UDP", TON 1993).
Actually this reminds me of a totally off-topic thing, but same concept. h1kari's wep cracker was fast at the time because, among other things, it would also decrypt data and calculate the CRC32 at the same time in one pass, thus, not having to scan the buffer twice. I totally agree that since you are copying the buffer from user -> kernel anyway, you might as well calculate the checksum.
Quoted 3 lines
Using partial checksums may give performance close to the
copy_and_checksumcase, since in the extreme case only the header is checksummed - and this has to be done irrespective of which copy function is used.
I think header checksums will be a big win. Immagine high frequency jumbo frames. Also, in real life, I don't know how easy it is to corrupt packets. I think the typical scenario is packet loss. In practice, many MACs have their own checksums anyway.
Quoted 3 lines
| http://darkircop.org/check.png
This is very interesting to see but I could not tell what the axes were for - do higher numbers mean better relative performance or the other way around?
It's an awful graph yes; it was a quick drawing i did to show my boss. x-axis is packet size, y-axis is checksums per second [x1000]. it's running the i386 checksum code in userland. The linux emulation curve is actually a freebsd box running the linux checksum binary via linux emulation.
Basically, from that plot intel sucks =D That said, we weren't using the latest Xeons with a shorter pipeline. It's probably some weirdness in the branch predictions and instruction pipeline. Dunno; didn't investigate further.