From: "Kiryl Shutsemau (Meta)" <[email protected]> The two file events are named for khugepaged, from when khugepaged was the only thing that collapsed and the code lived in its file. Neither is true now: MADV_COLLAPSE reaches them through the same entry point, and they are emitted from collapse.c beside the events that do use the collapse name.
Rename mm_khugepaged_scan_file to mm_collapse_scan_file, and mm_khugepaged_collapse_file to mm_collapse_file. Every event a collapse emits is then under one prefix: the anonymous and file scans, the per-candidate verdicts, the fault-in, the round, and the file collapse itself. mm_khugepaged_scan keeps its name. That one is the daemon reporting a scan pass of its own, from khugepaged.c, and it is not something a collapse emits. Renaming a tracepoint breaks anything watching the old name. In tree that is raw_tp_null_args[], which tells the BPF verifier that the folio argument of both may be NULL. Without a matching entry the verifier would let a program dereference it unchecked. Assisted-by: Claude-Code:claude-opus-5 Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]> --- include/trace/events/huge_memory.h | 4 ++-- kernel/bpf/btf.c | 4 ++-- mm/collapse.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h index d7c0195ace92..5d0891e03bb0 100644 --- a/include/trace/events/huge_memory.h +++ b/include/trace/events/huge_memory.h @@ -308,7 +308,7 @@ TRACE_EVENT(mm_collapse_huge_page_swapin, __entry->order) ); -TRACE_EVENT(mm_khugepaged_scan_file, +TRACE_EVENT(mm_collapse_scan_file, TP_PROTO(struct mm_struct *mm, struct folio *folio, struct file *file, int present, int swap, int result), @@ -342,7 +342,7 @@ TRACE_EVENT(mm_khugepaged_scan_file, __print_symbolic(__entry->result, SCAN_STATUS)) ); -TRACE_EVENT(mm_khugepaged_collapse_file, +TRACE_EVENT(mm_collapse_file, TP_PROTO(struct mm_struct *mm, struct folio *new_folio, pgoff_t index, unsigned long addr, bool is_shmem, struct file *file, int nr, int result), diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index c4673a54c4ba..58f78274d989 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -6705,8 +6705,8 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = { /* huge_memory */ { "mm_khugepaged_scan_pmd", 0x10 }, { "mm_collapse_huge_page_isolate", 0x1 }, - { "mm_khugepaged_scan_file", 0x10 }, - { "mm_khugepaged_collapse_file", 0x10 }, + { "mm_collapse_scan_file", 0x10 }, + { "mm_collapse_file", 0x10 }, /* kmem */ { "mm_page_alloc", 0x1 }, { "mm_page_pcpu_drain", 0x1 }, diff --git a/mm/collapse.c b/mm/collapse.c index d0d28e8dfcea..6c17c83a4e21 100644 --- a/mm/collapse.c +++ b/mm/collapse.c @@ -3519,7 +3519,7 @@ static enum scan_result collapse_file(struct mm_struct *mm, unsigned long addr, folio_put(new_folio); out: VM_BUG_ON(!list_empty(&pagelist)); - trace_mm_khugepaged_collapse_file(mm, new_folio, index, addr, is_shmem, file, HPAGE_PMD_NR, result); + trace_mm_collapse_file(mm, new_folio, index, addr, is_shmem, file, HPAGE_PMD_NR, result); return result; } @@ -3625,7 +3625,7 @@ static enum scan_result collapse_pagecache_pmd(struct mm_struct *mm, } } - trace_mm_khugepaged_scan_file(mm, folio, file, present, swap, result); + trace_mm_collapse_scan_file(mm, folio, file, present, swap, result); return result; } -- 2.54.0
