ANDROID: vendor_hooks:vendor hook for madvise_cold_or_pageout_pte_range.

add vendor hook in madvise_cold_or_pageout_pte_range to control the
pages to be reclaimed more fine-grained.

Bug: 284808098
Signed-off-by: zhouwenhao <zhouwenhao@xiaomi.com>
Change-Id: I298fde436df192cea9b1541d857f3a46808e06f2
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
xiaofeng
2024-05-30 11:10:47 +08:00
committed by Suren Baghdasaryan
parent c2c2655f83
commit 8d9c81d3ca
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -521,3 +521,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_direct_reclaim_enter);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_direct_reclaim_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_may_oom_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_calculate_totalreserve_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_pageout_skip);
+3
View File
@@ -49,6 +49,9 @@ DECLARE_RESTRICTED_HOOK(android_rvh_bitmap_find_best_next_area,
bool status),
TP_ARGS(bitmap, bitmap_maxno, start, bitmap_count, mask,
offset, bitmap_no, status), 1);
DECLARE_HOOK(android_vh_madvise_cold_pageout_skip,
TP_PROTO(struct vm_area_struct *vma, struct folio *folio, bool pageout, bool *need_skip),
TP_ARGS(vma, folio, pageout, need_skip));
/*
DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
+7
View File
@@ -447,6 +447,7 @@ restart:
flush_tlb_batched_pending(mm);
arch_enter_lazy_mmu_mode();
for (; addr < end; pte += nr, addr += nr * PAGE_SIZE) {
bool need_skip = false;
nr = 1;
ptent = ptep_get(pte);
@@ -470,6 +471,12 @@ restart:
if (!folio || folio_is_zone_device(folio))
continue;
trace_android_vh_madvise_cold_pageout_skip(vma, folio, pageout,
&need_skip);
if (need_skip)
continue;
/*
* If we encounter a large folio, only split it if it is not
* fully mapped within the range we are operating on. Otherwise