All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allan McAleavy <allan.mcaleavy@gmail.com>
To: linux-mm@kvack.org
Subject: Re: Page Cache Monitoring ( Hit/Miss )
Date: Fri, 11 Dec 2015 15:22:31 +0000	[thread overview]
Message-ID: <CAF6XsOesbGN=rH0g_2JXMeyovbVPyKYvPQ-jgoVbh8cZkhyFiA@mail.gmail.com> (raw)
In-Reply-To: <CAF6XsOeYWvuNm=uuMCM4YD4a2dCoBe6TvimygPKRe4PMiHwQmw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2077 bytes --]

We add a page to the page cache using add_to_page_cache_lru based on the
following assumptions

READ MISS - So add an entry
no_cached_page - so we need to create one from
do_generic_file_read - during a file read operation
page_cache_read - calls add_to_page_cache_lru

CREATE A PAGE
struct page *__page_cache_alloc(gfp_t gfp)

page has flags which identify if dirty or free

Writes
add_to_page_cache
writepage / writepages
set_page_dirty_buffers
do_generic_mapping_read  - ASYNC read of pages in readahed?
__block_write_full_page

READ
find_get_pages


mark_page_accessed() for measuring cache accesses
mark_buffer_dirty() for measuring cache writes
add_to_page_cache_lru() for measuring page additions
account_page_dirtied() for measuring page dirties


 (mark_page_accessed - mark_buffer_dirty) & misses = (add_to_page_cache_lru
- account_page_dirtied),
 from this I then work out the hit ratio etc. Is there any other key
functions I should be tracing?

add_to_page_cache_lru
lru_cache_add
swap.c
filemap.c
vmscan.c

Functions used
lru_cache_add_active_or_unevictable
add_to_page_cache_lru
putback_lru_page

So best use lru_cache_add for additions.

account_page_dirtied() for measuring page dirties
set_page_dirty - calls above
__set_page_dirty_nobuffers - calls above also

mark_buffer_dirty() for measuring cache writes - this calls
__set_page_dirty ( are we getting twice the calls here? )
mark_page_accessed - calls SetPageActive

On Thu, Dec 10, 2015 at 9:42 AM, Allan McAleavy <allan.mcaleavy@gmail.com>
wrote:

> Hi Folks,
>
> I am working on a rewrite of Brendan Greggs original cachestat (ftrace)
> script into bcc. What I was looking for was a steer in the right direction
> for what functions to trace. At present I trace the following.
>
> add_to_page_cache_lru
> account_page_dirtied
> mark_page_accessed
> mark_buffer_dirty
>
> Where total = (mark_page_accessed - mark_buffer_dirty) & misses =
> (add_to_page_cache_lru - account_page_dirtied), from this I then work out
> the hit ratio etc. Is there any other key functions I should be tracing?
>
> Thanks
>

[-- Attachment #2: Type: text/html, Size: 3778 bytes --]

      reply	other threads:[~2015-12-11 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  9:42 Page Cache Monitoring ( Hit/Miss ) Allan McAleavy
2015-12-11 15:22 ` Allan McAleavy [this message]

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='CAF6XsOesbGN=rH0g_2JXMeyovbVPyKYvPQ-jgoVbh8cZkhyFiA@mail.gmail.com' \
    --to=allan.mcaleavy@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.