ANDROID: mm: add vendor hook to abort scan by order

Add vendor hook to determine whether kswapd scan should be aborted
based on the order of scan_control. Avoid excessive kswapd reclaim.

Bug: 365902592
Change-Id: Iafd31ba629db2a65afc19e48e22ec8ad0bbe4cf2
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
yipeng xiang 2024-09-11 16:18:33 +08:00 committed by Suren Baghdasaryan
parent 4082972733
commit 9d48e18a60
3 changed files with 6 additions and 1 deletions

View File

@ -336,6 +336,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_continue_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_continue_reclaim);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_file_is_tiny_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_file_is_tiny_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan_order);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);

View File

@ -61,6 +61,9 @@ DECLARE_HOOK(android_vh_file_is_tiny_bypass,
DECLARE_HOOK(android_vh_mglru_should_abort_scan, DECLARE_HOOK(android_vh_mglru_should_abort_scan,
TP_PROTO(u64 *ext, bool *bypass), TP_PROTO(u64 *ext, bool *bypass),
TP_ARGS(ext, bypass)); TP_ARGS(ext, bypass));
DECLARE_HOOK(android_vh_mglru_should_abort_scan_order,
TP_PROTO(unsigned int order, bool *bypass),
TP_ARGS(order, bypass));
DECLARE_HOOK(android_vh_rebalance_anon_lru_bypass, DECLARE_HOOK(android_vh_rebalance_anon_lru_bypass,
TP_PROTO(bool *bypass), TP_PROTO(bool *bypass),
TP_ARGS(bypass)); TP_ARGS(bypass));

View File

@ -5498,8 +5498,9 @@ static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc)
if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order))) if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order)))
return true; return true;
trace_android_vh_mglru_should_abort_scan_order(sc->order, &bypass);
/* check the order to exclude compaction-induced reclaim */ /* check the order to exclude compaction-induced reclaim */
if (!current_is_kswapd() || sc->order) if ((!current_is_kswapd() || sc->order) && !bypass)
return false; return false;
mark = sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING ? mark = sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING ?