[PATCH v5] mm, vmscan: retry kswapd's priority loop with cache_trim_mode off on failure

From: Byungchul Park
Date: Sun Mar 03 2024 - 21:30:44 EST


Sorry for noise. I should've applied v5's change in v4.

Changes from v4:
1. Make other scans start with may_cache_trim_mode = 1.

Changes from v3:
1. Update the test result in the commit message with v4.
2. Retry the whole priority loop with cache_trim_mode off again,
rather than forcing the mode off at the highest priority,
when the mode doesn't work. (feedbacked by Johannes Weiner)

Changes from v2:
1. Change the condition to stop cache_trim_mode.

From - Stop it if it's at high scan priorities, 0 or 1.
To - Stop it if it's at high scan priorities, 0 or 1, and
the mode didn't work in the previous turn.

(feedbacked by Huang Ying)

2. Change the test result in the commit message after testing
with the new logic.

Changes from v1:
1. Add a comment describing why this change is necessary in code
and rewrite the commit message with how to reproduce and what
the result is using vmstat. (feedbacked by Andrew Morton and
Yu Zhao)
2. Change the condition to avoid cache_trim_mode from
'sc->priority != 1' to 'sc->priority > 1' to reflect cases
where the priority goes to zero all the way. (feedbacked by
Yu Zhao)
--->8---