From 7c4c173a5f4465522cb56c23e81d642be22889eb Mon Sep 17 00:00:00 2001 From: Minchan Kim Date: Tue, 6 May 2025 19:57:28 +0000 Subject: [PATCH] ANDROID: adjust check_flags parameter Along with I746f4fbc20df5cf394d7644ff2cd6f25916c9790, it also needs to adjust check_flags. Bug: 416087944 Bug: 436973821 Change-Id: I2871ab305963da00fcc8b0a7755bd8db7859e4c5 Signed-off-by: Minchan Kim (cherry picked from commit 8f5494d90cac148e269da2937456243ed2d5906f) Signed-off-by: Richard Chang --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/mm.h | 3 +++ mm/page_alloc.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 581063585792..8b1388e201d4 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -447,6 +447,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_slab); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_process_madvise_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages_prepare_init); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_one_page_flag_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_post_alloc_hook); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_new_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_pageout_return_error); diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index f2fb13af2140..fd8aaf64f261 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -355,6 +355,9 @@ DECLARE_HOOK(android_vh_free_folio_bypass, DECLARE_HOOK(android_vh_free_pages_prepare_init, TP_PROTO(struct page *page, int nr_pages, bool *init), TP_ARGS(page, nr_pages, init)); +DECLARE_HOOK(android_vh_free_one_page_flag_check, + TP_PROTO(unsigned long *flags), + TP_ARGS(flags)); DECLARE_HOOK(android_vh_post_alloc_hook, TP_PROTO(struct page *page, unsigned int order, bool *init), TP_ARGS(page, order, init)); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 18e78a14626e..c2cfe2a1311a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -915,6 +915,7 @@ static inline void __free_one_page(struct page *page, bool to_tail; bool bypass = false; int max_order = zone_max_order(zone); + unsigned long check_flags; trace_android_vh_free_one_page_bypass(page, zone, order, migratetype, (int)fpi_flags, &bypass); @@ -923,7 +924,9 @@ static inline void __free_one_page(struct page *page, return; VM_BUG_ON(!zone_is_initialized(zone)); - VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page); + check_flags = PAGE_FLAGS_CHECK_AT_PREP; + trace_android_vh_free_one_page_flag_check(&check_flags); + VM_BUG_ON_PAGE(page->flags & check_flags, page); VM_BUG_ON(migratetype == -1); VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page);