kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: mulyadi.santosa@gmail.com (Mulyadi Santosa)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to measure performance inside Kernel?
Date: Sun, 12 Feb 2012 18:46:42 +0700	[thread overview]
Message-ID: <CAGdaadbhyetAmXv_6Uookw9jLKCc2__xm04+VEdOzEkHWHzaXA@mail.gmail.com> (raw)
In-Reply-To: <CA+MoWDr=6Pg8p6+GRD4v0gA=6OHqe+zimpvJkqqtASgtY+4r-Q@mail.gmail.com>

Hi Peter...

On Sat, Feb 11, 2012 at 20:57, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> Graeme,
>
> I found a problem on my code. I was calling kmalloc() only once for
> both portions of code. The result is that the first loop that accessed
> the memory was finding some penalty. Now I'm calling independent
> kmalloc for each test.

Sorry for jumping in the mid of discussion :)

I read your code and I think kmalloc can be streamlined here. I
recommend that kmalloc() allocate total memory needed to handle whole
q->buf[] array. something like (CMIIW):

q->buf=kmalloc(sizeof(struct vb_buffer)*q->num_buffers,GFP_KERNEL)

then access q->buf[1], q->buf[2] etc.

This way, AFAIK, you will likely get not only virtually continous
pages, but also physical continous pages. And that will ease
prefetching into L1/L2 cache.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

  reply	other threads:[~2012-02-12 11:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09 12:58 How to measure performance inside Kernel? Peter Senna Tschudin
2012-02-09 18:12 ` michi1 at michaelblizek.twilightparadox.com
2012-02-10 21:47 ` Peter Senna Tschudin
2012-02-10 22:06   ` Jeff Haran
2012-02-11  0:22     ` Peter Senna Tschudin
2012-02-11  3:44       ` Graeme Russ
2012-02-11 13:14         ` Peter Senna Tschudin
2012-02-11 13:57           ` Peter Senna Tschudin
2012-02-12 11:46             ` Mulyadi Santosa [this message]
2012-02-13 23:13               ` Peter Senna Tschudin
2012-02-14  3:43                 ` Mulyadi Santosa
2012-02-11  7:34       ` michi1 at michaelblizek.twilightparadox.com
2012-02-11  7:22   ` michi1 at michaelblizek.twilightparadox.com
2012-02-11 13:29     ` Peter Senna Tschudin

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=CAGdaadbhyetAmXv_6Uookw9jLKCc2__xm04+VEdOzEkHWHzaXA@mail.gmail.com \
    --to=mulyadi.santosa@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).