ANDROID: vendor_hooks: Add tune swappiness hook in get_scan_count()

Add hook in get_scan_count() for customized swappiness.
Partial cherry-pick of aosp/2119426.

Bug: 297985476

Change-Id: I9d4074cf1a4097ff2a96be04646a01624cbd8dc3
Signed-off-by: Tangquan Zheng <zhengtangquan@oppo.com>
This commit is contained in:
Tangquan Zheng 2023-08-29 17:44:48 +08:00 committed by Treehugger Robot
parent dd87a7122c
commit 8e6550add2
3 changed files with 6 additions and 0 deletions

View File

@ -322,6 +322,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake);

View File

@ -43,6 +43,9 @@ enum scan_balance;
DECLARE_HOOK(android_vh_tune_scan_type, DECLARE_HOOK(android_vh_tune_scan_type,
TP_PROTO(enum scan_balance *scan_type), TP_PROTO(enum scan_balance *scan_type),
TP_ARGS(scan_type)); TP_ARGS(scan_type));
DECLARE_HOOK(android_vh_tune_swappiness,
TP_PROTO(int *swappiness),
TP_ARGS(swappiness));
#endif /* _TRACE_HOOK_VMSCAN_H */ #endif /* _TRACE_HOOK_VMSCAN_H */
/* This part must be outside protection */ /* This part must be outside protection */
#include <trace/define_trace.h> #include <trace/define_trace.h>

View File

@ -2966,6 +2966,8 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
goto out; goto out;
} }
trace_android_vh_tune_swappiness(&swappiness);
/* /*
* Global reclaim will swap to prevent OOM even with no * Global reclaim will swap to prevent OOM even with no
* swappiness, but memcg users want to use this knob to * swappiness, but memcg users want to use this knob to