filemap: Convert tracing of page cache operations to folio

Pass the folio instead of a page.  The page was already implicitly a
folio as it accessed page->mapping directly.  Add the order of the folio
to the tracepoint, as this is important information.  Also drop printing
the address of the struct page as the pfn provides better information
than the struct page address.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
parent 621db488
......@@ -15,43 +15,45 @@
DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
TP_PROTO(struct page *page),
TP_PROTO(struct folio *folio),
TP_ARGS(page),
TP_ARGS(folio),
TP_STRUCT__entry(
__field(unsigned long, pfn)
__field(unsigned long, i_ino)
__field(unsigned long, index)
__field(dev_t, s_dev)
__field(unsigned char, order)
),
TP_fast_assign(
__entry->pfn = page_to_pfn(page);
__entry->i_ino = page->mapping->host->i_ino;
__entry->index = page->index;
if (page->mapping->host->i_sb)
__entry->s_dev = page->mapping->host->i_sb->s_dev;
__entry->pfn = folio_pfn(folio);
__entry->i_ino = folio->mapping->host->i_ino;
__entry->index = folio->index;
if (folio->mapping->host->i_sb)
__entry->s_dev = folio->mapping->host->i_sb->s_dev;
else
__entry->s_dev = page->mapping->host->i_rdev;
__entry->s_dev = folio->mapping->host->i_rdev;
__entry->order = folio_order(folio);
),
TP_printk("dev %d:%d ino %lx page=%p pfn=0x%lx ofs=%lu",
TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u",
MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
__entry->i_ino,
pfn_to_page(__entry->pfn),
__entry->pfn,
__entry->index << PAGE_SHIFT)
__entry->index << PAGE_SHIFT,
__entry->order)
);
DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache,
TP_PROTO(struct page *page),
TP_ARGS(page)
TP_PROTO(struct folio *folio),
TP_ARGS(folio)
);
DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
TP_PROTO(struct page *page),
TP_ARGS(page)
TP_PROTO(struct folio *folio),
TP_ARGS(folio)
);
TRACE_EVENT(filemap_set_wb_err,
......
......@@ -225,7 +225,7 @@ void __delete_from_page_cache(struct page *page, void *shadow)
struct folio *folio = page_folio(page);
struct address_space *mapping = page->mapping;
trace_mm_filemap_delete_from_page_cache(page);
trace_mm_filemap_delete_from_page_cache(folio);
filemap_unaccount_folio(mapping, folio);
page_cache_delete(mapping, folio, shadow);
......@@ -346,9 +346,10 @@ void delete_from_page_cache_batch(struct address_space *mapping,
spin_lock(&mapping->host->i_lock);
xa_lock_irq(&mapping->i_pages);
for (i = 0; i < pagevec_count(pvec); i++) {
trace_mm_filemap_delete_from_page_cache(pvec->pages[i]);
struct folio *folio = page_folio(pvec->pages[i]);
filemap_unaccount_folio(mapping, page_folio(pvec->pages[i]));
trace_mm_filemap_delete_from_page_cache(folio);
filemap_unaccount_folio(mapping, folio);
}
page_cache_delete_batch(mapping, pvec);
xa_unlock_irq(&mapping->i_pages);
......@@ -959,7 +960,7 @@ noinline int __filemap_add_folio(struct address_space *mapping,
goto error;
}
trace_mm_filemap_add_to_page_cache(&folio->page);
trace_mm_filemap_add_to_page_cache(folio);
return 0;
error:
folio->mapping = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment