public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: kuznet@ms2.inr.ac.ru
Cc: linux-kernel@vger.kernel.org
Subject: Re: efficient copy_to_user and copy_from_user routines in Linux Kernel
Date: Tue, 25 Jun 2002 12:47:20 -0700	[thread overview]
Message-ID: <3D18C8C8.D35FF1A3@zip.com.au> (raw)
In-Reply-To: 200206251743.VAA00510@sex.inr.ac.ru

kuznet@ms2.inr.ac.ru 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.

Yup.

> 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
2.4.

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...  http://www.zip.com.au/~akpm/linux/cptimer.tar.gz
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.

-

  reply	other threads:[~2002-06-25 19:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-24 19:34 efficient copy_to_user and copy_from_user routines in Linux Kernel Mala Anand
2002-06-24 19:33 ` David S. Miller
2002-06-24 20:24 ` [Lse-tech] " Niels Christiansen
2002-06-25 17:03 ` Andrew Morton
2002-06-25 17:43   ` kuznet
2002-06-25 19:47     ` Andrew Morton [this message]
2002-06-25 21:46       ` Chris Friesen
2002-06-26 13:54     ` Hirokazu Takahashi
2002-06-25 18:58   ` [Lse-tech] " Niels Christiansen
2002-06-25 19:11     ` Dave Jones
2002-06-26 12:58       ` Andi Kleen
2002-06-26 14:50   ` Bill Hartner
  -- strict thread matches above, loose matches on Subject: below --
2002-06-28 11:50 Mala Anand
2002-06-28 12:35 Mala Anand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D18C8C8.D35FF1A3@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox