mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 01:45:18 +02:00
ANDROID: mm: add vendor_hook for mglru shrink
We want to perform a certain amount of reclaim operations on a non-root memcg, but in should_abort_scan, the condition !root_reclaim(sc) causes unnecessary loop retries even if the nr_to_reclaim condition is met. The call stack is as follows: shrink_zones shrink_node shrink_node_memcgs shrink_lruvec lru_gen_shrink_lruvec try_to_shrink_lruvec should_abort_scan if (!root_reclaim(sc)) retry once more The hook function: trace_android_vh_mglru_should_abort_scan is added to identify the intent to reclaim a specific memcg and bypass the !root_reclaim(sc) condition. Bug: 365008739 Change-Id: I297986dde2bf8ffe937cff3ffc814da92067029a Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
parent
c0e21888b2
commit
4105548575
|
@ -335,6 +335,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done);
|
|||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_scan_control);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_should_continue_reclaim);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_file_is_tiny_bypass);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mglru_should_abort_scan);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_folio_look_around_ref);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
|
||||
|
|
|
@ -58,6 +58,9 @@ DECLARE_HOOK(android_vh_should_continue_reclaim,
|
|||
DECLARE_HOOK(android_vh_file_is_tiny_bypass,
|
||||
TP_PROTO(bool file_is_tiny, bool *bypass),
|
||||
TP_ARGS(file_is_tiny, bypass));
|
||||
DECLARE_HOOK(android_vh_mglru_should_abort_scan,
|
||||
TP_PROTO(u64 *ext, bool *bypass),
|
||||
TP_ARGS(ext, bypass));
|
||||
DECLARE_HOOK(android_vh_rebalance_anon_lru_bypass,
|
||||
TP_PROTO(bool *bypass),
|
||||
TP_ARGS(bypass));
|
||||
|
|
|
@ -5486,9 +5486,13 @@ static bool should_abort_scan(struct lruvec *lruvec, struct scan_control *sc)
|
|||
{
|
||||
int i;
|
||||
enum zone_watermarks mark;
|
||||
bool bypass = false;
|
||||
|
||||
#ifdef CONFIG_ANDROID_VENDOR_OEM_DATA
|
||||
trace_android_vh_mglru_should_abort_scan(&sc->android_vendor_data1, &bypass);
|
||||
#endif
|
||||
/* don't abort memcg reclaim to ensure fairness */
|
||||
if (!root_reclaim(sc))
|
||||
if (!root_reclaim(sc) && !bypass)
|
||||
return false;
|
||||
|
||||
if (sc->nr_reclaimed >= max(sc->nr_to_reclaim, compact_gap(sc->order)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user