ANDROID: vendor_hooks: tune reclaim swappiness or scan type

Add hooks for reclaim

Bug: 185438290
Change-Id: Ib9eec302b1df4da7e98c77b94541af28c34a8613
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
xiaofeng
2021-04-15 15:02:58 +08:00
committed by Hridya Valsaraju
parent edb1a85895
commit 35dafe72dd
3 changed files with 29 additions and 0 deletions

View File

@@ -51,6 +51,7 @@
#include <trace/hooks/gpiolib.h>
#include <trace/hooks/signal.h>
#include <trace/hooks/logbuf.h>
#include <trace/hooks/vmscan.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -240,3 +241,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_get_timer);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_adj_current_limit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);

View File

@@ -0,0 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM vmscan
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_VMSCAN_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_tune_scan_type,
TP_PROTO(char *scan_type),
TP_ARGS(scan_type));
DECLARE_HOOK(android_vh_tune_swappiness,
TP_PROTO(int *swappiness),
TP_ARGS(swappiness));
#endif /* _TRACE_HOOK_VMSCAN_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -63,6 +63,9 @@
#define CREATE_TRACE_POINTS
#include <trace/events/vmscan.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/vmscan.h>
struct scan_control {
/* How many pages shrink_list() should reclaim */
unsigned long nr_to_reclaim;
@@ -2267,6 +2270,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
goto out;
}
trace_android_vh_tune_swappiness(&swappiness);
/*
* Global reclaim will swap to prevent OOM even with no
* swappiness, but memcg users want to use this knob to
@@ -2337,6 +2341,7 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
fraction[1] = fp;
denominator = ap + fp;
out:
trace_android_vh_tune_scan_type((char *)(&scan_balance));
for_each_evictable_lru(lru) {
int file = is_file_lru(lru);
unsigned long lruvec_size;