diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 0d33ee078bd6..20a40e94757f 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -336,6 +336,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_begin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_madvise_pageout_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_reclaim_folio_list); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_mapping_shrinkable); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 5687abf81821..0da6dae34709 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -137,6 +137,8 @@ static inline bool mapping_empty(struct address_space *mapping) return xa_empty(&mapping->i_pages); } +extern void _trace_android_rvh_mapping_shrinkable(bool *shrinkable); + /* * mapping_shrinkable - test if page cache state allows inode reclaim * @mapping: the page cache mapping @@ -161,7 +163,11 @@ static inline bool mapping_empty(struct address_space *mapping) static inline bool mapping_shrinkable(struct address_space *mapping) { void *head; + bool shrinkable = false; + _trace_android_rvh_mapping_shrinkable(&shrinkable); + if (shrinkable) + return true; /* * On highmem systems, there could be lowmem pressure from the * inodes before there is highmem pressure from the page diff --git a/include/trace/hooks/mm.h b/include/trace/hooks/mm.h index 6603dafabfd3..b8527123813f 100644 --- a/include/trace/hooks/mm.h +++ b/include/trace/hooks/mm.h @@ -112,6 +112,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_madvise_pageout_end, DECLARE_RESTRICTED_HOOK(android_rvh_reclaim_folio_list, TP_PROTO(struct list_head *folio_list, void *private), TP_ARGS(folio_list, private), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_mapping_shrinkable, + TP_PROTO(bool *shrinkable), + TP_ARGS(shrinkable), 1); DECLARE_HOOK(android_vh_smaps_pte_entry, TP_PROTO(swp_entry_t entry, unsigned long *writeback, unsigned long *same, unsigned long *huge), diff --git a/mm/filemap.c b/mm/filemap.c index e8744ab862fd..373165ba8a1f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -60,6 +60,12 @@ #include +void _trace_android_rvh_mapping_shrinkable(bool *shrinkable) +{ + trace_android_rvh_mapping_shrinkable(shrinkable); +} +EXPORT_SYMBOL_GPL(_trace_android_rvh_mapping_shrinkable); + /* * Shared mappings implemented 30.11.1994. It's not fully working yet, * though.