From: "Xin Zhao" <uszhaoxin@gmail.com>
To: "John Anthony Kazos Jr." <jakj@j-a-k-j.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Linux page cache issue?
Date: Wed, 28 Mar 2007 12:15:26 -0400 [thread overview]
Message-ID: <4ae3c140703280915n5a310ee6se300f6a7487bbe10@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.0.83.0703281157010.2527@sigma.j-a-k-j.com>
You are right. If the device is very big, the radix tree could be huge
as well. Maybe the lookup it not that cheap. But the per-device tree
can be optimized too. A simple way I can immediately image is: evenly
split a device into N parts by the sector numbers. For each part, we
maintain a radix tree. Let's do a math. Suppose I have a 32G partition
(2^35 bytes) and each data block is 4K bytes (2^12). So the partition
has 2^23 blocks. I divide the blocks into 1024 (2^12) groups. Each
group will only have 2^11 blocks. With radix tree, the average lookup
overhead for each tree would be log(2^11) steps. That is 11 in-memory
tree traverse to locate a page. This cost seems to be acceptable. I
don't really measure it though. As to the memory used for maintain the
radix trees, I believe it is trivial considering the memory size of
modern computers.
Xin
On 3/28/07, John Anthony Kazos Jr. <jakj@j-a-k-j.com> wrote:
> > The lookup of the per-device radix tree may incur some overhead. But
> > compared to the slow disk access, looking up an in-memory radix tree is
> > much cheaper and should be trivial, I guess.
>
> I would consider whether or not it really is trivial. You'd have to think
> hard about just how much of your filesystem is going to be sharing data
> blocks. If you fail to find in the per-file tree, then fail to find in the
> per-device tree, then still have to read the block from the device, and
> this is happening too often, then the additional overhead of the
> per-device tree check for non-cached items may end up cancelling the
> savings for cached items.
>
next prev parent reply other threads:[~2007-03-28 16:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-28 6:45 Linux page cache issue? Xin Zhao
2007-03-28 7:35 ` junjie cai
2007-03-28 7:38 ` Matthias Kaehlcke
2007-03-28 14:10 ` Dave Kleikamp
2007-03-28 15:39 ` Xin Zhao
[not found] ` <alpine.DEB.0.83.0703281157010.2527@sigma.j-a-k-j.com>
2007-03-28 16:15 ` Xin Zhao [this message]
2007-03-29 9:27 ` Jan Kara
2007-03-29 14:41 ` Xin Zhao
2007-04-02 12:51 ` Jan Kara
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=4ae3c140703280915n5a310ee6se300f6a7487bbe10@mail.gmail.com \
--to=uszhaoxin@gmail.com \
--cc=jakj@j-a-k-j.com \
--cc=linux-fsdevel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).