mm: compaction: simplify should_compact_retry()
authorJohannes Weiner <hannes@cmpxchg.org>
Fri, 19 May 2023 12:39:56 +0000 (14:39 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 9 Jun 2023 23:25:36 +0000 (16:25 -0700)
commit511a69b27fe6c2d7312789bd9e2e40b00e3903ef
tree9976642a6036c00fd4b58ed0f3c3ad625674b604
parentecd8b2928f2efc7b678b361d51920c15b5ef3885
mm: compaction: simplify should_compact_retry()

The different branches for retry are unnecessarily complicated.  There are
really only three outcomes: progress (retry n times), skipped (retry if
reclaim can help), failed (retry with higher priority).

Rearrange the branches and the retry counter to make it simpler.

[hannes@cmpxchg.org: restore behavior when hitting max_retries]
Link: https://lkml.kernel.org/r/20230602144705.GB161817@cmpxchg.org
Link: https://lkml.kernel.org/r/20230519123959.77335-3-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c