From 1aa26f0017f18e085fb83c582ed27aa9da708c6b Mon Sep 17 00:00:00 2001 From: Bing Han Date: Mon, 30 May 2022 15:09:17 +0800 Subject: [PATCH] ANDROID: vendor_hook: Add hook in page_referenced_one() Add android_vh_page_referenced_one_end at the end of function page_referenced_one to update the status that whether the page need to be reclaimed to a specified swap location. Bug: 234214858 Signed-off-by: Bing Han Change-Id: Ia06a229956328ef776da5d163708dcb011a327fb --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/rmap.c | 1 + 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b013d648356b..e340569dd60b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -412,6 +412,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migrate_page_states); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_one_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 2b75c4e46f6a..66953b1a950f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -164,6 +164,9 @@ DECLARE_HOOK(android_vh_waiting_for_page_migration, DECLARE_HOOK(android_vh_migrate_page_states, TP_PROTO(struct page *page, struct page *newpage), TP_ARGS(page, newpage)); +DECLARE_HOOK(android_vh_page_referenced_one_end, + TP_PROTO(struct vm_area_struct *vma, struct page *page, int referenced), + TP_ARGS(vma, page, referenced)); DECLARE_HOOK(android_vh_count_pswpin, TP_PROTO(struct swap_info_struct *sis), TP_ARGS(sis)); diff --git a/mm/rmap.c b/mm/rmap.c index 22464daf02d6..1a0a75d8b4ce 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -819,6 +819,7 @@ static bool page_referenced_one(struct page *page, struct vm_area_struct *vma, pra->vm_flags |= vma->vm_flags; } + trace_android_vh_page_referenced_one_end(vma, page, referenced); if (!pra->mapcount) return false; /* To break the loop */