ANDROID: vendor hooks: add hook record workingset refault count

By recording the workingset refault count of important processes and
passing it to the userspace policy, optimizations can be made
to improve system performance.

Bug: 340146803

Change-Id: Ibf9791d9645e392b49c24480ca0be5e7fe99bebe
Signed-off-by: Lei Liu <liulei.rjpt@vivo.corp-partner.google.com>
(cherry picked from commit c196e17dffdb946434b92410507395a586407be4)
Signed-off-by: DANGJian <dangjian@honor.corp-partner.google.com>
This commit is contained in:
Lei Liu
2024-05-22 15:46:42 +08:00
committed by Todd Kjos
parent 9a57b38950
commit 40610f49d4
3 changed files with 7 additions and 0 deletions

View File

@@ -463,6 +463,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_handle_trylock_failed_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_hibernate_state);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_should_be_protected);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_referenced_check_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_workingset_refault);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapmem_gather_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapmem_gather_add_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapmem_gather_finish);

View File

@@ -270,6 +270,9 @@ DECLARE_HOOK(android_vh_page_should_be_protected,
s8 priority, u64 *ext, int *should_protect),
TP_ARGS(folio, nr_scanned, priority, ext, should_protect));
DECLARE_HOOK(android_vh_count_workingset_refault,
TP_PROTO(struct folio *folio),
TP_ARGS(folio));
DECLARE_HOOK(android_vh_swapmem_gather_init,
TP_PROTO(struct mm_struct *mm),
TP_ARGS(mm));

View File

@@ -16,6 +16,7 @@
#include <linux/dax.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <trace/hooks/mm.h>
/*
* Double CLOCK lists
@@ -401,6 +402,8 @@ void workingset_refault(struct folio *folio, void *shadow)
int memcgid;
long nr;
trace_android_vh_count_workingset_refault(folio);
if (lru_gen_enabled()) {
lru_gen_refault(folio, shadow);
return;