ANDROID: vendor_hooks: Add hooks for lookaround
Add hooks for support lookaround in memory reclamation. - android_vh_test_clear_look_around_ref - android_vh_check_page_look_around_ref - android_vh_look_around_migrate_page - android_vh_look_around Bug: 241079328 Signed-off-by: Peifeng Li <lipeifeng@oppo.com> Change-Id: I9a606ae71d2f1303df3b02403b30bc8fdc9d06dd (cherry picked from commit f50f24e781738c8e5aa9f285d8726202f33107d6)
This commit is contained in:
@@ -446,6 +446,10 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_cma_first_check);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_page_alloced);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_order_alloced);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compact_finished);
|
||||
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);
|
||||
/*
|
||||
* For type visibility
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ struct oom_control;
|
||||
struct slabinfo;
|
||||
struct track;
|
||||
struct address_space;
|
||||
struct page_vma_mapped_walk;
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
|
||||
TP_PROTO(gfp_t *flags),
|
||||
@@ -229,6 +230,16 @@ DECLARE_HOOK(android_vh_alloc_flags_cma_adjust,
|
||||
DECLARE_HOOK(android_vh_rmqueue_cma_fallback,
|
||||
TP_PROTO(struct zone *zone, unsigned int order, struct page **page),
|
||||
TP_ARGS(zone, order, page));
|
||||
DECLARE_HOOK(android_vh_test_clear_look_around_ref,
|
||||
TP_PROTO(struct page *page),
|
||||
TP_ARGS(page));
|
||||
DECLARE_HOOK(android_vh_look_around_migrate_page,
|
||||
TP_PROTO(struct page *old_page, struct page *new_page),
|
||||
TP_ARGS(old_page, new_page));
|
||||
DECLARE_HOOK(android_vh_look_around,
|
||||
TP_PROTO(struct page_vma_mapped_walk *pvmw, struct page *page,
|
||||
struct vm_area_struct *vma, int *referenced),
|
||||
TP_ARGS(pvmw, page, vma, referenced));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
@@ -51,6 +51,9 @@ DECLARE_HOOK(android_vh_tune_memcg_scan_type,
|
||||
DECLARE_HOOK(android_vh_tune_inactive_ratio,
|
||||
TP_PROTO(unsigned long *inactive_ratio, int file),
|
||||
TP_ARGS(inactive_ratio, file))
|
||||
DECLARE_HOOK(android_vh_check_page_look_around_ref,
|
||||
TP_PROTO(struct page *page, int *skip),
|
||||
TP_ARGS(page, skip));
|
||||
#endif /* _TRACE_HOOK_VMSCAN_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/migrate.h>
|
||||
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
int isolate_movable_page(struct page *page, isolate_mode_t mode)
|
||||
@@ -562,6 +565,7 @@ void migrate_page_states(struct page *newpage, struct page *page)
|
||||
SetPageChecked(newpage);
|
||||
if (PageMappedToDisk(page))
|
||||
SetPageMappedToDisk(newpage);
|
||||
trace_android_vh_look_around_migrate_page(page, newpage);
|
||||
|
||||
/* Move dirty on pages not done by migrate_page_move_mapping() */
|
||||
if (PageDirty(page))
|
||||
|
||||
@@ -74,6 +74,8 @@
|
||||
#include <linux/khugepaged.h>
|
||||
#include <linux/buffer_head.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
#include <trace/hooks/vmscan.h>
|
||||
|
||||
#include <asm/sections.h>
|
||||
#include <asm/tlbflush.h>
|
||||
#include <asm/div64.h>
|
||||
@@ -2618,6 +2620,7 @@ static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags
|
||||
set_page_pfmemalloc(page);
|
||||
else
|
||||
clear_page_pfmemalloc(page);
|
||||
trace_android_vh_test_clear_look_around_ref(page);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -812,6 +812,7 @@ static bool page_referenced_one(struct page *page, struct vm_area_struct *vma,
|
||||
}
|
||||
|
||||
if (pvmw.pte) {
|
||||
trace_android_vh_look_around(&pvmw, page, vma, &referenced);
|
||||
if (lru_gen_enabled() && pte_young(*pvmw.pte) &&
|
||||
!(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) {
|
||||
lru_gen_look_around(&pvmw);
|
||||
|
||||
@@ -1260,12 +1260,16 @@ static enum page_references page_check_references(struct page *page,
|
||||
unsigned long vm_flags;
|
||||
bool should_protect = false;
|
||||
bool trylock_fail = false;
|
||||
int ret = 0;
|
||||
|
||||
trace_android_vh_page_should_be_protected(page, &should_protect);
|
||||
if (unlikely(should_protect))
|
||||
return PAGEREF_ACTIVATE;
|
||||
|
||||
trace_android_vh_page_trylock_set(page);
|
||||
trace_android_vh_check_page_look_around_ref(page, &ret);
|
||||
if (ret)
|
||||
return ret;
|
||||
referenced_ptes = page_referenced(page, 1, sc->target_mem_cgroup,
|
||||
&vm_flags);
|
||||
referenced_page = TestClearPageReferenced(page);
|
||||
|
||||
Reference in New Issue
Block a user