Skip to content

Commit

Permalink
ANDROID: vendor hook to control blk_plug for shrink_lruvec
Browse files Browse the repository at this point in the history
Add vendor hook to contorl blk plugging for shrink_lruvec.

Bug: 255471591
Bug: 238728493
Change-Id: Iba2603ff2e1b62cf2ee8fd6969d8ccd71416a288
Signed-off-by: Minchan Kim <[email protected]>
  • Loading branch information
Minchan Kim authored and Martin Liu committed Nov 9, 2022
1 parent 4378d4c commit 0c724ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/android/vendor_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions include/trace/hooks/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 6 additions & 2 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;

/*
Expand Down

0 comments on commit 0c724ff

Please sign in to comment.