ANDROID: mm: Add vendor hook to get status of the page being migrated

The vendor hook provides a way to get status of the page during the
migration.It will help to provide more accurate information when
running unisoc memory feature.

Bug: 295409783
Test: buid pass
Change-Id: I48fe75d81a6d9befdfbd75a4da0d6a0c783aec1b
Signed-off-by: xiaosong.ma <xiaosong.ma@unisoc.com>
This commit is contained in:
xiaosong.ma
2023-08-10 16:59:54 +08:00
committed by Treehugger Robot
parent 6537ae4cd5
commit 28caaf3085
4 changed files with 16 additions and 0 deletions

View File

@@ -453,6 +453,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_page_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_page_migrating);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_clear_page_migrating);
/*
* For type visibility
*/

View File

@@ -243,6 +243,12 @@ DECLARE_HOOK(android_vh_look_around,
DECLARE_HOOK(android_vh_try_cma_fallback,
TP_PROTO(struct zone *zone, unsigned int order, bool *try_cma),
TP_ARGS(zone, order, try_cma));
DECLARE_HOOK(android_vh_set_page_migrating,
TP_PROTO(struct page *page),
TP_ARGS(page));
DECLARE_HOOK(android_vh_clear_page_migrating,
TP_PROTO(struct page *page),
TP_ARGS(page));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View File

@@ -279,10 +279,14 @@ void remove_migration_ptes(struct page *old, struct page *new, bool locked)
.arg = old,
};
trace_android_vh_set_page_migrating(new);
if (locked)
rmap_walk_locked(new, &rwc);
else
rmap_walk(new, &rwc);
trace_android_vh_clear_page_migrating(new);
}
/*

View File

@@ -2066,10 +2066,14 @@ void try_to_migrate(struct page *page, enum ttu_flags flags)
if (!PageKsm(page) && PageAnon(page))
rwc.invalid_vma = invalid_migration_vma;
trace_android_vh_set_page_migrating(page);
if (flags & TTU_RMAP_LOCKED)
rmap_walk_locked(page, &rwc);
else
rmap_walk(page, &rwc);
trace_android_vh_clear_page_migrating(page);
}
/*