From: noname noname <namei.unix@gmail.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
jaxboe@fusionio.com, akpm@linux-foundation.org,
fengguang.wu@intel.com
Subject: [RFC PATCH 0/5] Add accountings for Page Cache
Date: Wed, 2 Mar 2011 16:37:54 +0800 [thread overview]
Message-ID: <AANLkTik7MA6YcrWVbjFhQsN0arR72xmH9g1M2Yi-E_B-@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3308 bytes --]
[Summery]
In order to evaluate page cache efficiency, system admins are happy to
know whether a block of data is cached for subsequent use, or whether
the page is read-in but seldom used. This patch extends an effort to
provide such kind of information. We adds three counters, which are
exported to the user space, for the Page Cache that is almost
transparent to the applications. This would benifit some heavy page
cache users that might try to tune the performance in hybrid storage
situation.
[Detail]
The kernel would query the page cache first when it tries to manipulate
file data & meta data. If the target data is out there, this is called
page cache _hit_ and will save one IO operation to disk. If the target
data is absent, then the kernel will issue the real IO requests to the
disk, this is called page cache _miss_.
Two counters are page cache specific, that is, page cache _hit_ and
_miss_. Another counter named _readpages_ is also added because the
kernel relys on the readahead module to make the real read requests to
save future read IOs. The _readpages_ is supposed to give more
information about kernel read operations.
The different combinations of three counters would give some hints on
kernel page cache system. For example, nr(hit) + nr(miss) would means
how many request[nr(request)] the kernel ask for in some time.
nr(miss)/nr(requests) would produce miss ratio, etc.
There is a long request from our operation teams who run hapdoop in a
very large scale. They ask for some information about underlying Page
Cache system when they are tuning the applications.
The statistics are collected per partition. This would benifit
performance tuning at the situation when the hybrid storage are applied
(for example, SSD + SAS + SATA).
Currently only regular file data in the page acche are collected.[meta
data accounting is also under consideration]
There is still much work that needs to be done, but it is better for me
to send it out to review and get feedbacks as early as possible.
[Performance]
Since the patch is on the one of the hottest code path of the kernel, I
did a simple function gragh tracing on the sys_read() path by
_no-inlining_ the hit function with loop-reading a 2G
file.[hit/miss/readpages share virtually the same logic]
1)first read a 2G file from disk into page cache.
2)read 2G file in a loop without disk IOs.
3)function graph tracing on sys_read()
This is the worst case for hit function, it is called every time when
kernel query the page cache.
In the context, test shows that sys_read() costs 8.567us, hit() costs
0.173us (approximate to put_page() function), so 0.173 / 8.567 = 2%.
Any comments are more than welcome :)
-Yuan
--------------------
Liu Yuan(5)
x86/Kconfig: Add Page Cache Accounting entry
block: Add functions and data types for Page Cache Accounting
block: Make page cache counters work with sysfs
mm: Add hit/miss accounting for Page Cache
mm: Add readpages accounting
arch/x86/Kconfig.debug | 9 +++++++
block/genhd.c | 6 ++++
fs/partitions/check.c | 23 ++++++++++++++++++
include/linux/genhd.h | 60
++++++++++++++++++++++++++++++++++++++++++++++++
mm/filemap.c | 27 ++++++++++++++++++---
mm/readahead.c | 2 +
6 files changed, 123 insertions(+), 4 deletions(-)
[-- Attachment #2: Type: text/html, Size: 3583 bytes --]
next reply other threads:[~2011-03-02 8:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 8:37 noname noname [this message]
2011-03-03 1:50 ` KOSAKI Motohiro
2011-03-04 1:55 ` Liu Yuan
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=AANLkTik7MA6YcrWVbjFhQsN0arR72xmH9g1M2Yi-E_B-@mail.gmail.com \
--to=namei.unix@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=jaxboe@fusionio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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