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
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 2f8253b7e6e563cc19cffa120c72f6f528664103)
This commit is contained in:
Minchan Kim
2022-10-18 09:03:15 -07:00
committed by Richard Chang
parent 1eeadb47e0
commit bb6ab2be93
3 changed files with 8 additions and 0 deletions

View File

@@ -278,3 +278,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_genl_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pagevec_drain);

View File

@@ -77,6 +77,9 @@ DECLARE_HOOK(android_vh_mm_compaction_begin,
DECLARE_HOOK(android_vh_mm_compaction_end, DECLARE_HOOK(android_vh_mm_compaction_end,
TP_PROTO(struct compact_control *cc, long vendor_ret), TP_PROTO(struct compact_control *cc, long vendor_ret),
TP_ARGS(cc, vendor_ret)); TP_ARGS(cc, vendor_ret));
DECLARE_HOOK(android_vh_pagevec_drain,
TP_PROTO(struct page *page, bool *ret),
TP_ARGS(page, ret));
struct mem_cgroup; struct mem_cgroup;
DECLARE_HOOK(android_vh_mem_cgroup_alloc, DECLARE_HOOK(android_vh_mem_cgroup_alloc,
TP_PROTO(struct mem_cgroup *memcg), TP_PROTO(struct mem_cgroup *memcg),

View File

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