From: Theodore Tso <tytso@mit.edu>
To: linux-kernel@vger.kernel.org
Subject: Re: Very slow header cache in mutt if the maildir is on ext3
Date: Tue, 16 Dec 2008 22:25:17 -0500 [thread overview]
Message-ID: <20081217032517.GE10590@mit.edu> (raw)
In-Reply-To: <20081217005210.GA889@dose.home.local>
[-- Attachment #1: Type: text/plain, Size: 1787 bytes --]
On Wed, Dec 17, 2008 at 01:52:10AM +0100, Tino Keitel wrote:
> OK, after glancing at the strace output again, I see that the seek
> offsets are much more linear in the XFS case, whereas they are pretty
> random in the ext3 case. I guess that this is connected to the order
> of the files in the maildir, which depends on the FS type. So this is
> a bug in mutt which makes reading the header cache dead slow if the
> files are in an inconvenient order.
I *thought* mutt had a patch which sorted the files returned by
readdir() by inode number, and then opened the files sorted by inode
number order; maybe it was a distro-specific patch that was never
pushed back to mainline, though. In any case, sorting list of
directory entries as returned by readdir() by inode number does solves
the problem for ext3 with htree, and in general is a good optimization
for most filesystems. (See attached for a ld-preload hack that
demonstrates the optimization.)
There is also a fix in ext4 which partially addresses this problem,
which could be back-ported to ext3:
commit 240799cdf22bd789ea6852653c3b879d35ad0a6c
Author: Theodore Ts'o <tytso@mit.edu>
Date: Thu Oct 9 23:53:47 2008 -0400
ext4: Use readahead when reading an inode from the inode table
With modern hard drives, reading 64k takes roughly the same time as
reading a 4k block. So request readahead for adjacent inode table
blocks to reduce the time it takes when iterating over directories
(especially when doing this in htree sort order) in a cold cache case.
With this patch, the time it takes to run "git status" on a kernel
tree after flushing the caches via "echo 3 > /proc/sys/vm/drop_caches"
is reduced by 21%.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
- Ted
[-- Attachment #2: spd_readdir.tar.gz --]
[-- Type: application/octet-stream, Size: 3555 bytes --]
next prev parent reply other threads:[~2008-12-17 3:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 0:16 Very slow header cache in mutt if the maildir is on ext3 Tino Keitel
2008-12-17 0:52 ` Tino Keitel
2008-12-17 1:03 ` Tino Keitel
2008-12-17 3:25 ` Theodore Tso [this message]
2008-12-17 9:10 ` Tino Keitel
2008-12-17 12:32 ` Theodore Tso
2008-12-17 16:17 ` Tino Keitel
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=20081217032517.GE10590@mit.edu \
--to=tytso@mit.edu \
--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