Created attachment 39992 [details] test program to reproduce the issue Steps to reproduce: 1) dd if=/dev/zero of=source.img bs=1M count=1 2) make sure 10.99.0.1 can receive udp packets on port 1234 (e.g. run netcat -lp1234 -u > /dev/zero there) 2) gcc -g -O2 -Wall -o sendfileudp_test sendfileudp_test.c 3) perf record -g -- ./sendfileudp_test -fsource.img -l10737418240 10.99.0.1 1234 -s60000 -msend-sendfile -g 4) perf report -g Expected results: 4) since the SO_NO_CHECK option is used the kernel does not calculate checksums for the UDP payload Actual results: 4) A lot of time is spent calculating checksums: 46.81% sendfileudp_tes [kernel] [k] csum_partial 5.30% sendfileudp_tes [kernel] [k] _spin_lock | | |--99.95%-- sendfile64 --0.05%-- [...] 4.61% sendfileudp_tes [kernel] [k] ip_append_page 3.68% sendfileudp_tes [kernel] [k] ip_fragment 2.04% sendfileudp_tes [kernel] [k] _local_bh_enable_ip 1.84% sendfileudp_tes [kernel] [k] ip_finish_output2 More info: 1) If I use packets that are smaller than my MTU (9000) the kernel does not calculate checksums. It seems that SO_NO_CHECK works if no fragmentation occurs: $ perf record -g -- ./sendfileudp_test -fsource.img -l10737418240 10.99.0.1 1234 -s8192 -msend-sendfile -g $ perf report -g 6.93% sendfileudp_tes [kernel] [k] _spin_lock 5.25% sendfileudp_tes [kernel] [k] ip_append_page 3.21% sendfileudp_tes [kernel] [k] _spin_lock_bh | |--99.95%-- sendfile64 --0.05%-- [...] 3.16% sendfileudp_tes [kernel] [k] _local_bh_enable_ip 2.97% sendfileudp_tes [kernel] [k] ip_finish_output2
Created attachment 40002 [details] this patch works for me but somebody else should verify it
Please don't send patches via bugzilla - it causes lots of problems with our usual patch management and review processes. Please send this patch via email as per Documentation/SubmittingPatches. Suitable recipients may be found via scripts/get_maintainer.pl. netdev@vger.kernel.org will suffice. Thanks.
Sure. It's now at http://marc.info/?l=linux-netdev&m=129232307330696&w=2 with Message-Id: <1292313093-11973-1-git-send-email-timo.lindfors@iki.fi>
Alan, if you think that the bug has been resolved can you please point me to the commit that fixes it? To my best understanding the issue still exists.