ANDROID: vendor hook to control blk_plug for shrink_lruvec

Add vendor hook to contorl blk plugging for shrink_lruvec.

Bug: 255471591
Bug: 238728493
Change-Id: Iba2603ff2e1b62cf2ee8fd6969d8ccd71416a288
Signed-off-by: Minchan Kim <minchan@google.com>
This commit is contained in:
Minchan Kim
2022-11-02 09:04:41 -07:00
parent c0ce22abf7
commit 89fed37332
3 changed files with 10 additions and 2 deletions

View File

@@ -285,6 +285,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_include_reserved_zone);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_slowpath);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_madvise_blk_plug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_inactive_list_blk_plug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_lruvec_blk_plug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_reclaim_pages_plug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zap_pte_range_tlb_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zap_pte_range_tlb_force_flush);

View File

@@ -106,6 +106,9 @@ DECLARE_HOOK(android_vh_do_madvise_blk_plug,
DECLARE_HOOK(android_vh_shrink_inactive_list_blk_plug,
TP_PROTO(bool *do_plug),
TP_ARGS(do_plug));
DECLARE_HOOK(android_vh_shrink_lruvec_blk_plug,
TP_PROTO(bool *do_plug),
TP_ARGS(do_plug));
DECLARE_HOOK(android_vh_reclaim_pages_plug,
TP_PROTO(bool *do_plug),
TP_ARGS(do_plug));

View File

@@ -5275,6 +5275,7 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
unsigned long nr_reclaimed = 0;
unsigned long nr_to_reclaim = sc->nr_to_reclaim;
struct blk_plug plug;
bool do_plug = true;
bool scan_adjusted;
if (lru_gen_enabled()) {
@@ -5301,7 +5302,9 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
scan_adjusted = (!cgroup_reclaim(sc) && !current_is_kswapd() &&
sc->priority == DEF_PRIORITY);
blk_start_plug(&plug);
trace_android_vh_shrink_lruvec_blk_plug(&do_plug);
if (do_plug)
blk_start_plug(&plug);
while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||
nr[LRU_INACTIVE_FILE]) {
unsigned long nr_anon, nr_file, percentage;
@@ -5373,7 +5376,8 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
scan_adjusted = true;
}
blk_finish_plug(&plug);
if (do_plug)
blk_finish_plug(&plug);
sc->nr_reclaimed += nr_reclaimed;
/*