ANDROID: vendor hook to control blk_plug for shrink_lruvec

Add vendor hook to contorl blk plugging for shrink_lruvec.

Merged CL bcf1e503f5ed774dc28126a0f1a8c839717eafac:
ANDROID: adjust vendor hook to control blk_plug

Bug: 255471591
Bug: 238728493
Change-Id: Iba2603ff2e1b62cf2ee8fd6969d8ccd71416a288
Signed-off-by: Minchan Kim <minchan@google.com>
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 89fed37332fd48e0cd13b256cd85d6929d5da319)
This commit is contained in:
Minchan Kim
2022-11-02 09:04:41 -07:00
committed by Richard Chang
parent 7df45e50a5
commit a8962f626f
3 changed files with 10 additions and 2 deletions

View File

@@ -287,4 +287,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bh_lru_install);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_skip_lru_disable); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_skip_lru_disable);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_madvise_blk_plug); 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_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_reclaim_pages_plug);

View File

@@ -98,6 +98,9 @@ DECLARE_HOOK(android_vh_do_madvise_blk_plug,
DECLARE_HOOK(android_vh_shrink_inactive_list_blk_plug, DECLARE_HOOK(android_vh_shrink_inactive_list_blk_plug,
TP_PROTO(bool *do_plug), TP_PROTO(bool *do_plug),
TP_ARGS(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, DECLARE_HOOK(android_vh_reclaim_pages_plug,
TP_PROTO(bool *do_plug), TP_PROTO(bool *do_plug),
TP_ARGS(do_plug)); TP_ARGS(do_plug));

View File

@@ -5647,6 +5647,7 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
unsigned long nr_to_reclaim = sc->nr_to_reclaim; unsigned long nr_to_reclaim = sc->nr_to_reclaim;
bool proportional_reclaim; bool proportional_reclaim;
struct blk_plug plug; struct blk_plug plug;
bool do_plug = true;
if (lru_gen_enabled()) { if (lru_gen_enabled()) {
lru_gen_shrink_lruvec(lruvec, sc); lru_gen_shrink_lruvec(lruvec, sc);
@@ -5672,7 +5673,9 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
proportional_reclaim = (!cgroup_reclaim(sc) && !current_is_kswapd() && proportional_reclaim = (!cgroup_reclaim(sc) && !current_is_kswapd() &&
sc->priority == DEF_PRIORITY); 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] || while (nr[LRU_INACTIVE_ANON] || nr[LRU_ACTIVE_FILE] ||
nr[LRU_INACTIVE_FILE]) { nr[LRU_INACTIVE_FILE]) {
unsigned long nr_anon, nr_file, percentage; unsigned long nr_anon, nr_file, percentage;
@@ -5742,7 +5745,8 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
nr[lru] = targets[lru] * (100 - percentage) / 100; nr[lru] = targets[lru] * (100 - percentage) / 100;
nr[lru] -= min(nr[lru], nr_scanned); nr[lru] -= min(nr[lru], nr_scanned);
} }
blk_finish_plug(&plug); if (do_plug)
blk_finish_plug(&plug);
sc->nr_reclaimed += nr_reclaimed; sc->nr_reclaimed += nr_reclaimed;
/* /*