kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: rcpilot2010@gmail.com (Abu Rasheda)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Module vs Kernel main performacne
Date: Wed, 30 May 2012 17:17:11 -0700	[thread overview]
Message-ID: <CACYKDthMEzc8j9ABYDSm=ebio0HMS7Th7BX8rgUSjpEFs2vqgw@mail.gmail.com> (raw)
In-Reply-To: <CACYKDtg6b4Ec4NLPJsWxK7zzhMyk-h-tgwoetLQX+p7Ck4gSnw@mail.gmail.com>

On Wed, May 30, 2012 at 2:44 PM, Abu Rasheda <rcpilot2010@gmail.com> wrote:
> I did another experiment.
>
> Wrote a stand alone module and user program which does ioctl and pass
> buffer to kernel module.
>
> User program passes a buffer through ioctl and kernel module does
> kmalloc on it and calls copy_from_user, kfree and return. Test program
> send 120 gigabyte data to module.
>
> If I pass 1k buffer per call, I get
>
> 115,396,349,819 instructions ? ? ? ? ? ? ?# ? ?0.90 ?insns per cycle
> ? ? ?[95.00%]
>
> as I increase size of buffer, insns per cycle keep decreasing. Here is the data:
>
> ? ?1k 0.90 ?insns per cycle
> ? ?8k 0.43 ?insns per cycle
> ?43k 0.18 ?insns per cycle
> 100k 0.08 ?insns per cycle
>
> Showing that cop_from_user is more efficient when copy data is small,
> why it is so ?

Did another experiment:

User program sending 43k and allocating 43k after entering ioctl and
copy_from_user smaller portion in each call to copy_from_user:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
copy_from_user  0.25k at a time 0.56  insns per cycle
copy_from_user  0.50k at a time 0.42  insns per cycle
copy_from_user  1.00k at a time 0.36  insns per cycle
copy_from_user  2.00k at a time 0.29  insns per cycle
copy_from_user  3.00k at a time 0.26  insns per cycle
copy_from_user  4.00k at a time 0.23  insns per cycle
copy_from_user  8.00k at a time 0.21  insns per cycle
copy_from_user 16.00k at a time 0.19  insns per cycle


User program sending 43k, allocating smaller chunk and sending that
chunk to call to copy_from_user:
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Allocated 0.25k and copy_from_user  0.25k at a time 1.04 insns per cycle
Allocated 0.50k and copy_from_user  0.50k at a time 0.90 insns per cycle
Allocated 1.00k and copy_from_user  1.00k at a time 0.79 insns per cycle
Allocated 2.00k and copy_from_user  2.00k at a time 0.67 insns per cycle
Allocated 4.00k and copy_from_user  4.00k at a time 0.53 insns per cycle
Allocated 8.00k and copy_from_user  8.00k at a time 0.42 insns per cycle
Allocated 16.00k and copy_from_user 16.00k at a time 0.33 insns per cycle
Allocated 32.00k and copy_from_user 32.00k at a time 0.22 insns per cycle

  reply	other threads:[~2012-05-31  0:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 23:50 Module vs Kernel main performacne Abu Rasheda
2012-05-30  4:18 ` Mulyadi Santosa
2012-05-30  4:51   ` Abu Rasheda
2012-05-30 16:45     ` Mulyadi Santosa
2012-05-30 21:44       ` Abu Rasheda
2012-05-31  0:17         ` Abu Rasheda [this message]
2012-05-31  5:35         ` Mulyadi Santosa
2012-05-31 13:35           ` Abu Rasheda
2012-06-01  0:27             ` Chetan Nanda
2012-06-01 18:52               ` Abu Rasheda
2012-06-07 13:11                 ` Peter Senna Tschudin
2012-06-07 17:47                   ` Abu Rasheda
2012-06-07 18:10                     ` Peter Senna Tschudin
2012-06-09  1:52                       ` Abu Rasheda
2012-06-07 23:36 ` Peter Senna Tschudin
2012-06-07 23:41   ` Abu Rasheda

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='CACYKDthMEzc8j9ABYDSm=ebio0HMS7Th7BX8rgUSjpEFs2vqgw@mail.gmail.com' \
    --to=rcpilot2010@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).