public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
To: linux-kernel@vger.kernel.org
Subject: madvise failure
Date: Thu, 7 May 2009 14:10:17 +0200	[thread overview]
Message-ID: <20090507121012.GA17048@ub> (raw)

In an application something like
	p = mmap(0, sz, PROT_READ, MAP_PRIVATE, fd, 0);
	madvise(p, sz, MADV_SEQUENTIAL);
is done for a small number of files, each with a size of a few GB.
A single sequential pass is done over these files - essentially a merge.

On an old machine the madvise is useful, and decreases total time.
But on a more recent machine, with more memory, the madvise makes
things worse. There, it seems better not to reveal to the kernel
that the data will be read sequentially.

Timing (six files of 4GB each, quadcore Intel Q9550, 16GB memory,
kernel 2.6.27 [Ubuntu], two other processes active):
with madvise, 7 runs: real time varying 9m10s - 37m29s,
without madvise, 6 runs: real time fairly constant 5m45s - 5m54s.


Andries


             reply	other threads:[~2009-05-07 12:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 12:10 Andries E. Brouwer [this message]
2009-05-08  1:07 ` madvise failure KAMEZAWA Hiroyuki
2009-05-08  3:23   ` Andries E. Brouwer

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=20090507121012.GA17048@ub \
    --to=andries.brouwer@cwi.nl \
    --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