ANDROID: vendor_hook: Add hook in inactive_is_low()
Provide a vendor hook android_vh_inactive_is_low to replace the calculation process of inactive_ratio. The alternative calculation algorithm takes into account the difference between file pages and anonymous pages. Bug: 234214858 Signed-off-by: Bing Han <bing.han@transsion.com> Change-Id: I6cf9c47fbc440852cc36e04f49d644146eb2c6af
This commit is contained in:
parent
bb9c8f5256
commit
6b04959511
@ -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);
|
||||
|
@ -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 <trace/define_trace.h>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user