public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: edwin <edwintorok@gmail.com>, Ingo Molnar <mingo@elte.hu>,
	rml@tech9.net, Linux Kernel <linux-kernel@vger.kernel.org>,
	"Thomas Gleixner mingo@redhat.com" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task
Date: Mon, 25 Aug 2008 09:48:01 -0400	[thread overview]
Message-ID: <20080825134801.GN1408@mit.edu> (raw)
In-Reply-To: <1219664477.8515.54.camel@twins>

On Mon, Aug 25, 2008 at 01:41:17PM +0200, Peter Zijlstra wrote:
> 
> I would certainly consider this for small (< 1M?) files. With mmap the
> faults and pte overhead aren't free either, and the extra memcpy from
> pread() isn't that much.
> 

Even for very big files, if you're only doing a single sequential pass
over a very large file (for example when converting a Canon raw image
file to TIFF format --- I know because I was trying to optimize dcraw
a while aback), you take the page fault for each 4k page, and so
simply using read/pread is faster.  And that's on a single-threded
program.  With a multithreaded program, the locking issues come on top
of that.

Maybe if I had used hugepages it would have been a win, I suppose, but
I never tried the experiment.  And this was several years ago, on much
older hardware, so maybe the relative times of doing the memory copy
versus the page fault, but I wouldn't be surprised if it's even more
expensive to do the mmap, relatively speaking.

							- Ted

  reply	other threads:[~2008-08-25 13:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <48B1CC15.2040006@gmail.com>
2008-08-25  5:51 ` Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task Peter Zijlstra
2008-08-25  7:04   ` edwin
2008-08-25  9:23     ` Peter Zijlstra
2008-08-25  9:49       ` Török Edwin
2008-08-25 10:02         ` Peter Zijlstra
2008-08-25 10:22           ` Török Edwin
2008-08-25 10:36             ` Peter Zijlstra
2008-08-25 11:00               ` edwin
2008-08-25 11:30                 ` edwin
2008-08-25 11:41                 ` Peter Zijlstra
2008-08-25 13:48                   ` Theodore Tso [this message]
2008-08-26  8:12                     ` Andi Kleen
2008-09-08 19:10                       ` Török Edwin
2008-09-12 19:16                         ` mmap/munmap latency on multithreaded apps, because pagefaults hold mmap_sem during disk read Török Edwin
2008-09-12 19:35                           ` Mike Waychison
2008-09-12 20:10                             ` Török Edwin
2008-08-25 10:37             ` Quad core CPUs loaded at only 50% when running a CPU and mmap intensive multi-threaded task Peter Zijlstra

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=20080825134801.GN1408@mit.edu \
    --to=tytso@mit.edu \
    --cc=edwintorok@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rml@tech9.net \
    --cc=tglx@linutronix.de \
    /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