[PATCH v6] mm, vmscan: retry kswapd's priority loop with cache_trim_mode off on failure
From: Byungchul Park
Date: Mon Mar 04 2024 - 03:22:47 EST
Changes from v5:
1. Make it retry the kswapd's scan priority loop with
cache_trim_mode off *only if* the mode didn't work in the
previous loop. (feedbacked by Huang Ying)
2. Take into account 'break's from the priority loop when making
the decision whether to retry. (feedbacked by Huang Ying)
3. Update the test result in the commit message.
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---