Re: [RFC PATCH] mm: trace filemap add and del

From: Andrew Morton
Date: Tue Nov 20 2012 - 18:57:25 EST


On Thu, 8 Nov 2012 20:54:10 +0100
Robert Jarzmik <robert.jarzmik@xxxxxxx> wrote:

> Use the events API to trace filemap loading and
> unloading of file pieces into the page cache.
>
> This patch aims at tracing the eviction reload
> cycle of executable and shared libraries pages in
> a memory constrained environment.
>
> The typical usage is to spot a specific device and
> inode (for example /lib/libc.so) to see the eviction
> cycles, and find out if frequently used code is
> rather spread across many pages (bad) or coallesced
> (good).

I suppose that could be useful.

>
> ...
>
> +TRACE_EVENT(mm_filemap_delete_from_page_cache,
> +
> + TP_PROTO(struct page *page),
> +
> + TP_ARGS(page),
> +
> + TP_STRUCT__entry(
> + __field(struct page *, page)
> + __field(unsigned long, i_no)

May as well call this i_ino - there's little benefit in using a
different identifier.

> + __field(unsigned long, pageofs)

"index".

> + __field(dev_t, s_dev)

Perhaps use super_block.s_id here

> + ),
> +
> + TP_fast_assign(
> + __entry->page = page;
> + __entry->i_no = page->mapping->host->i_ino;
> + __entry->pageofs = page->index;
> + if (page->mapping->host->i_sb)
> + __entry->s_dev = page->mapping->host->i_sb->s_dev;
> + else
> + __entry->s_dev = page->mapping->host->i_rdev;

and hence avoid all this stuff.

> + ),
> +
> + TP_printk("page=%p pfn=%lu blk=%d:%d inode+ofs=%lu+%lu",
> + __entry->page,
> + page_to_pfn(__entry->page),
> + MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
> + __entry->i_no,
> + __entry->pageofs << PAGE_SHIFT)
> +);
> +
> +TRACE_EVENT(mm_filemap_add_to_page_cache,

Dittoes.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/