ANDROID: mm: create vendor hooks for mm proactive compact

Add vendor hook to bypass compact_node if fragmentation score is tiny

Bug: 391491611
Change-Id: I66df2bce09e08137e4812468e024fa24fcb97259
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
yipeng xiang
2025-01-22 15:02:04 +08:00
committed by T.J. Mercier
parent 3dd8d27990
commit 891189b643
3 changed files with 21 additions and 0 deletions
+2
View File
@@ -62,6 +62,7 @@
#include <trace/hooks/power.h>
#include <trace/hooks/dmabuf.h>
#include <trace/hooks/signal.h>
#include <trace/hooks/compaction.h>
#include <trace/events/android_vendor_lmk.h>
@@ -313,6 +314,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmalloc_node_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vfree_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_continue_reclaim);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_proactive_compact_wmark_high);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_async_psi_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_retry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
+17
View File
@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM compaction
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_COMPACTION_H
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_proactive_compact_wmark_high,
TP_PROTO(int *wmark_high),
TP_ARGS(wmark_high));
#endif /* _TRACE_HOOK_COMPACTION_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+2
View File
@@ -66,6 +66,7 @@ static inline bool is_via_compact_memory(int order) { return false; }
#undef CREATE_TRACE_POINTS
#include <trace/hooks/vmscan.h>
#include <trace/hooks/compaction.h>
#define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order))
#define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order))
@@ -2285,6 +2286,7 @@ static bool should_proactive_compact_node(pg_data_t *pgdat)
return false;
wmark_high = fragmentation_score_wmark(false);
trace_android_vh_proactive_compact_wmark_high(&wmark_high);
return fragmentation_score_node(pgdat) > wmark_high;
}