[lkml]   [2002]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: efficient copy_to_user and copy_from_user routines in Linux Kernel wrote:
> Hello!
> > I changed tcp to use a different copy if either source or dest were
> > not eight-byte aligned, and found that the resulting improvement
> > across a mixed networking load was only 1%. Your numbers are higher,
> > so perhaps there are different alignments in the mix...
> Did you look at sender or changed both of the functions?

I changed it to use csum_copy_from_user() instead of copy_from_user()
if the source and dest weren't 8-byte aligned. No other changes
in there.

> After that accident TCP was changed and it does not use copy_from_user more,
> it does copy_and_csum even when no checksum is required. So, his results
> on sender side (except for strange anomaly at msg size 8K) just confirm
> nil effect of copy_from_user.


> What's about copy_to_user, we forgot about this at all,
> worrying mostly about sender side. :-)

We didn't really forget, but we were trying to get a 2.4 kernel out,
so it became a "fix in 2.5" item. You're right, we should fix it in

I wrote a little app to test this - it times a couple of copy algorithms
at all possible alignments. It may be useful for someone...
I think it covers everything - uncached/cache source/dest,
all possible transfer alignemnts.

The cost of getting it wrong is, iirc, 40% slowdown. In the
kernel's single most expensive function.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:22    [W:0.116 / U:7.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site