Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/khugepaged: add tracepoint to hpage_collapse_scan_file()

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>

authored by

Zach O'Keefe and committed by
Andrew Morton
d41fd201 34488399

+36 -1
+34
include/trace/events/huge_memory.h
··· 169 169 __entry->ret) 170 170 ); 171 171 172 + TRACE_EVENT(mm_khugepaged_scan_file, 173 + 174 + TP_PROTO(struct mm_struct *mm, struct page *page, const char *filename, 175 + int present, int swap, int result), 176 + 177 + TP_ARGS(mm, page, filename, present, swap, result), 178 + 179 + TP_STRUCT__entry( 180 + __field(struct mm_struct *, mm) 181 + __field(unsigned long, pfn) 182 + __string(filename, filename) 183 + __field(int, present) 184 + __field(int, swap) 185 + __field(int, result) 186 + ), 187 + 188 + TP_fast_assign( 189 + __entry->mm = mm; 190 + __entry->pfn = page ? page_to_pfn(page) : -1; 191 + __assign_str(filename, filename); 192 + __entry->present = present; 193 + __entry->swap = swap; 194 + __entry->result = result; 195 + ), 196 + 197 + TP_printk("mm=%p, scan_pfn=0x%lx, filename=%s, present=%d, swap=%d, result=%s", 198 + __entry->mm, 199 + __entry->pfn, 200 + __get_str(filename), 201 + __entry->present, 202 + __entry->swap, 203 + __print_symbolic(__entry->result, SCAN_STATUS)) 204 + ); 205 + 172 206 #endif /* __HUGE_MEMORY_H */ 173 207 #include <trace/define_trace.h>
+2 -1
mm/khugepaged.c
··· 2157 2157 } 2158 2158 } 2159 2159 2160 - /* TODO: tracepoints */ 2160 + trace_mm_khugepaged_scan_file(mm, page, file->f_path.dentry->d_iname, 2161 + present, swap, result); 2161 2162 return result; 2162 2163 } 2163 2164 #else