]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/khugepaged: add tracepoint to hpage_collapse_scan_file()
authorZach O'Keefe <zokeefe@google.com>
Thu, 22 Sep 2022 22:40:40 +0000 (15:40 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:33 +0000 (14:03 -0700)
Add huge_memory:trace_mm_khugepaged_scan_file tracepoint to
hpage_collapse_scan_file() analogously to hpage_collapse_scan_pmd().

While this change is targeted at debugging MADV_COLLAPSE pathway, the
"mm_khugepaged" prefix is retained for symmetry with
huge_memory:trace_mm_khugepaged_scan_pmd, which retains it's legacy name
to prevent changing kernel ABI as much as possible.

Link: https://lkml.kernel.org/r/20220907144521.3115321-5-zokeefe@google.com
Link: https://lkml.kernel.org/r/20220922224046.1143204-5-zokeefe@google.com
Signed-off-by: Zach O'Keefe <zokeefe@google.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Chris Kennelly <ckennelly@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: James Houghton <jthoughton@google.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rongwei Wang <rongwei.wang@linux.alibaba.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/trace/events/huge_memory.h
mm/khugepaged.c

index df33453b70fcf2a645c91b7cbb8a470a15df0183..935af4947917345d3651a2771827ec115a64df1c 100644 (file)
@@ -169,5 +169,39 @@ TRACE_EVENT(mm_collapse_huge_page_swapin,
                __entry->ret)
 );
 
+TRACE_EVENT(mm_khugepaged_scan_file,
+
+       TP_PROTO(struct mm_struct *mm, struct page *page, const char *filename,
+                int present, int swap, int result),
+
+       TP_ARGS(mm, page, filename, present, swap, result),
+
+       TP_STRUCT__entry(
+               __field(struct mm_struct *, mm)
+               __field(unsigned long, pfn)
+               __string(filename, filename)
+               __field(int, present)
+               __field(int, swap)
+               __field(int, result)
+       ),
+
+       TP_fast_assign(
+               __entry->mm = mm;
+               __entry->pfn = page ? page_to_pfn(page) : -1;
+               __assign_str(filename, filename);
+               __entry->present = present;
+               __entry->swap = swap;
+               __entry->result = result;
+       ),
+
+       TP_printk("mm=%p, scan_pfn=0x%lx, filename=%s, present=%d, swap=%d, result=%s",
+               __entry->mm,
+               __entry->pfn,
+               __get_str(filename),
+               __entry->present,
+               __entry->swap,
+               __print_symbolic(__entry->result, SCAN_STATUS))
+);
+
 #endif /* __HUGE_MEMORY_H */
 #include <trace/define_trace.h>
index 3bd6e2a741631bd738bd3c32a8081ed0764e493f..c7699fabf302f64d51b41cb73d838a019e0a4ef2 100644 (file)
@@ -2157,7 +2157,8 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr,
                }
        }
 
-       /* TODO: tracepoints */
+       trace_mm_khugepaged_scan_file(mm, page, file->f_path.dentry->d_iname,
+                                     present, swap, result);
        return result;
 }
 #else