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);