avoid trace NULL page.
Signed-off-by: yalin wang <yalin.wang2010@xxxxxxxxx>
---
include/trace/events/huge_memory.h | 20 ++++++++++++--------
mm/huge_memory.c | 6 +++---
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h
index 11c59ca..727647b 100644
--- a/include/trace/events/huge_memory.h
+++ b/include/trace/events/huge_memory.h
@@ -45,12 +45,14 @@ SCAN_STATUS
#define EM(a, b) {a, b},
#define EMe(a, b) {a, b}
-TRACE_EVENT(mm_khugepaged_scan_pmd,
+TRACE_EVENT_CONDITION(mm_khugepaged_scan_pmd,
- TP_PROTO(struct mm_struct *mm, unsigned long pfn, bool writable,
+ TP_PROTO(struct mm_struct *mm, struct page *page, bool writable,
bool referenced, int none_or_zero, int status, int unmapped),
- TP_ARGS(mm, pfn, writable, referenced, none_or_zero, status, unmapped),
+ TP_ARGS(mm, page, writable, referenced, none_or_zero, status, unmapped),
+
+ TP_CONDITION(page),
TP_STRUCT__entry(
__field(struct mm_struct *, mm)
@@ -64,7 +66,7 @@ TRACE_EVENT(mm_khugepaged_scan_pmd,
TP_fast_assign(
__entry->mm = mm;
- __entry->pfn = pfn;
+ __entry->pfn = page_to_pfn(page);