mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 02:36:21 +00:00
mm: vmscan: replace shrink_node() loop with a retry jump
Most of the function body is inside a loop, which imposes an additional indentation and scoping level that makes the code a bit hard to follow and modify. The looping only happens in case of reclaim-compaction, which isn't the common case. So rather than adding yet another function level to the reclaim path and have every reclaim invocation go through a level that only exists for one specific cornercase, use a retry goto. Link: http://lkml.kernel.org/r/20191022144803.302233-6-hannes@cmpxchg.org Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Roman Gushchin <guro@fb.com> Reviewed-by: Shakeel Butt <shakeelb@google.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b5ead35e7e
commit
d2af339706
11
mm/vmscan.c
11
mm/vmscan.c
@ -2729,13 +2729,11 @@ static bool pgdat_memcg_congested(pg_data_t *pgdat, struct mem_cgroup *memcg)
|
||||
static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
|
||||
{
|
||||
struct reclaim_state *reclaim_state = current->reclaim_state;
|
||||
struct mem_cgroup *root = sc->target_mem_cgroup;
|
||||
unsigned long nr_reclaimed, nr_scanned;
|
||||
bool reclaimable = false;
|
||||
|
||||
do {
|
||||
struct mem_cgroup *root = sc->target_mem_cgroup;
|
||||
struct mem_cgroup *memcg;
|
||||
|
||||
again:
|
||||
memset(&sc->nr, 0, sizeof(sc->nr));
|
||||
|
||||
nr_reclaimed = sc->nr_reclaimed;
|
||||
@ -2865,8 +2863,9 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc)
|
||||
current_may_throttle() && pgdat_memcg_congested(pgdat, root))
|
||||
wait_iff_congested(BLK_RW_ASYNC, HZ/10);
|
||||
|
||||
} while (should_continue_reclaim(pgdat, sc->nr_reclaimed - nr_reclaimed,
|
||||
sc));
|
||||
if (should_continue_reclaim(pgdat, sc->nr_reclaimed - nr_reclaimed,
|
||||
sc))
|
||||
goto again;
|
||||
|
||||
/*
|
||||
* Kswapd gives up on balancing particular nodes after too
|
||||
|
Loading…
x
Reference in New Issue
Block a user