ANDROID: mm: create vendor hooks for page alloc
Add vendor hook inside of get_page_from_freelist() to check and modify the watermark in some special situations. Additional page flag bit will be set for future identification. Separately, a vendor hook inside of page_add_new_anon_rmap() is added to set the referenced bit in some situations, e.g. if the special bit in the page flag mentioned before is set, we will give this page one more chance before it gets reclaimed. Bug: 279793368 Bug: 336900791 Change-Id: I363853a050a87201f6f368ccc580485dddd6c6b6 Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com> Signed-off-by: huzhanyuan <huzhanyuan@oppo.com> (cherry picked from commit 49fa9c5a7e11922caa132a0d014b46b7a72f10d3)
This commit is contained in:
committed by
T.J. Mercier
parent
552efa3faf
commit
3b58573735
@@ -224,6 +224,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_buffer_release);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_shrink_slab);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_page_wmark);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_add_new_anon_rmap);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio);
|
||||
|
||||
@@ -199,6 +199,13 @@ DECLARE_HOOK(android_vh_show_smap,
|
||||
unsigned long swap_shared, unsigned long writeback,
|
||||
unsigned long same, unsigned long huge),
|
||||
TP_ARGS(m, swap_shared, writeback, same, huge));
|
||||
DECLARE_HOOK(android_vh_get_page_wmark,
|
||||
TP_PROTO(unsigned int alloc_flags, unsigned long *page_wmark),
|
||||
TP_ARGS(alloc_flags, page_wmark));
|
||||
DECLARE_HOOK(android_vh_page_add_new_anon_rmap,
|
||||
TP_PROTO(struct page *page, struct vm_area_struct *vma,
|
||||
unsigned long address),
|
||||
TP_ARGS(page, vma, address));
|
||||
DECLARE_HOOK(android_vh_alloc_pages_slowpath_start,
|
||||
TP_PROTO(u64 *stime),
|
||||
TP_ARGS(stime));
|
||||
|
||||
@@ -66,6 +66,9 @@
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(mm_page_alloc);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(mm_page_free);
|
||||
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
/* Free Page Internal flags: for internal, non-pcp variants of free_pages(). */
|
||||
typedef int __bitwise fpi_t;
|
||||
|
||||
@@ -3682,6 +3685,7 @@ retry:
|
||||
|
||||
check_alloc_wmark:
|
||||
mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK);
|
||||
trace_android_vh_get_page_wmark(alloc_flags, &mark);
|
||||
if (!zone_watermark_fast(zone, order, mark,
|
||||
ac->highest_zoneidx, alloc_flags,
|
||||
gfp_mask)) {
|
||||
|
||||
@@ -1470,6 +1470,7 @@ void folio_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma,
|
||||
|
||||
__folio_mod_stat(folio, nr, nr_pmdmapped);
|
||||
mod_mthp_stat(folio_order(folio), MTHP_STAT_NR_ANON, 1);
|
||||
trace_android_vh_page_add_new_anon_rmap(&folio->page, vma, address);
|
||||
}
|
||||
|
||||
static __always_inline void __folio_add_file_rmap(struct folio *folio,
|
||||
|
||||
Reference in New Issue
Block a user