ANDROID: vendor hook to control pagevec flush

The pagevec batching causes lru_add_drain_all which is too expensive
sometimes. This patch adds a new vendor hook to drain the pagevec
immediately depending on the page's type.

Bug: 251881967
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: Id17e14e69197993ddad511a40c96e51674c02834
This commit is contained in:
Minchan Kim
2022-10-18 09:03:15 -07:00
parent 992b5f98ca
commit 2f8253b7e6
3 changed files with 8 additions and 0 deletions

View File

@@ -225,6 +225,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_calc_alloc_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pagevec_drain);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pagecache_get_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_get_page);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_cache_page);

View File

@@ -61,6 +61,9 @@ DECLARE_HOOK(android_vh_rmqueue,
unsigned int alloc_flags, int migratetype),
TP_ARGS(preferred_zone, zone, order,
gfp_flags, alloc_flags, migratetype));
DECLARE_HOOK(android_vh_pagevec_drain,
TP_PROTO(struct page *page, bool *ret),
TP_ARGS(page, ret));
DECLARE_HOOK(android_vh_pagecache_get_page,
TP_PROTO(struct address_space *mapping, pgoff_t index,
int fgp_flags, gfp_t gfp_mask, struct page *page),

View File

@@ -43,6 +43,9 @@
#define CREATE_TRACE_POINTS
#include <trace/events/pagemap.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/mm.h>
/* How many pages do we try to swap or page in/out together? */
int page_cluster;
@@ -267,6 +270,7 @@ static bool pagevec_add_and_need_flush(struct pagevec *pvec, struct page *page)
lru_cache_disabled())
ret = true;
trace_android_vh_pagevec_drain(page, &ret);
return ret;
}