diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 271df56a34ed..ed90b0476eb8 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -407,3 +407,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_tlb_conf); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node_memcgs); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ra_tuning_max_page); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low); diff --git a/include/trace/hooks/vmscan.h b/include/trace/hooks/vmscan.h index 7b4d222301af..e1c2c5b4fe9e 100644 --- a/include/trace/hooks/vmscan.h +++ b/include/trace/hooks/vmscan.h @@ -34,6 +34,10 @@ DECLARE_HOOK(android_vh_shrink_node_memcgs, DECLARE_HOOK(android_vh_tune_memcg_scan_type, TP_PROTO(struct mem_cgroup *memcg, char *scan_type), TP_ARGS(memcg, scan_type)); +DECLARE_HOOK(android_vh_inactive_is_low, + TP_PROTO(unsigned long gb, unsigned long *inactive_ratio, + enum lru_list inactive_lru, bool *skip), + TP_ARGS(gb, inactive_ratio, inactive_lru, skip)); #endif /* _TRACE_HOOK_VMSCAN_H */ /* This part must be outside protection */ #include diff --git a/mm/vmscan.c b/mm/vmscan.c index 0c47c99b4cdb..2dd501e78e1f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2270,11 +2270,16 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) unsigned long inactive, active; unsigned long inactive_ratio; unsigned long gb; + bool skip = false; inactive = lruvec_page_state(lruvec, NR_LRU_BASE + inactive_lru); active = lruvec_page_state(lruvec, NR_LRU_BASE + active_lru); gb = (inactive + active) >> (30 - PAGE_SHIFT); + trace_android_vh_inactive_is_low(gb, &inactive_ratio, inactive_lru, &skip); + if (skip) + goto out; + if (gb) inactive_ratio = int_sqrt(10 * gb); else @@ -2282,6 +2287,7 @@ static bool inactive_is_low(struct lruvec *lruvec, enum lru_list inactive_lru) trace_android_vh_tune_inactive_ratio(&inactive_ratio, is_file_lru(inactive_lru)); +out: return inactive * inactive_ratio < active; }