Skip to content

Commit 0aeb233

Browse files
hnaztorvalds
authored andcommitted
vmscan: remove all_unreclaimable scan control
This scan control is abused to communicate a return value from shrink_zones(). Write this idiomatically and remove the knob. Signed-off-by: Johannes Weiner <[email protected]> Reviewed-by: KOSAKI Motohiro <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 142762b commit 0aeb233

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

mm/vmscan.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ struct scan_control {
7373

7474
int swappiness;
7575

76-
int all_unreclaimable;
77-
7876
int order;
7977

8078
/*
@@ -1716,14 +1714,14 @@ static void shrink_zone(int priority, struct zone *zone,
17161714
* If a zone is deemed to be full of pinned pages then just give it a light
17171715
* scan then give up on it.
17181716
*/
1719-
static void shrink_zones(int priority, struct zonelist *zonelist,
1717+
static int shrink_zones(int priority, struct zonelist *zonelist,
17201718
struct scan_control *sc)
17211719
{
17221720
enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask);
17231721
struct zoneref *z;
17241722
struct zone *zone;
1723+
int progress = 0;
17251724

1726-
sc->all_unreclaimable = 1;
17271725
for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
17281726
sc->nodemask) {
17291727
if (!populated_zone(zone))
@@ -1739,19 +1737,19 @@ static void shrink_zones(int priority, struct zonelist *zonelist,
17391737

17401738
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
17411739
continue; /* Let kswapd poll it */
1742-
sc->all_unreclaimable = 0;
17431740
} else {
17441741
/*
17451742
* Ignore cpuset limitation here. We just want to reduce
17461743
* # of used pages by us regardless of memory shortage.
17471744
*/
1748-
sc->all_unreclaimable = 0;
17491745
mem_cgroup_note_reclaim_priority(sc->mem_cgroup,
17501746
priority);
17511747
}
17521748

17531749
shrink_zone(priority, zone, sc);
1750+
progress = 1;
17541751
}
1752+
return progress;
17551753
}
17561754

17571755
/*
@@ -1805,7 +1803,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
18051803
sc->nr_scanned = 0;
18061804
if (!priority)
18071805
disable_swap_token();
1808-
shrink_zones(priority, zonelist, sc);
1806+
ret = shrink_zones(priority, zonelist, sc);
18091807
/*
18101808
* Don't shrink slabs when reclaiming memory from
18111809
* over limit cgroups
@@ -1842,7 +1840,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
18421840
congestion_wait(BLK_RW_ASYNC, HZ/10);
18431841
}
18441842
/* top priority shrink_zones still had more to do? don't OOM, then */
1845-
if (!sc->all_unreclaimable && scanning_global_lru(sc))
1843+
if (ret && scanning_global_lru(sc))
18461844
ret = sc->nr_reclaimed;
18471845
out:
18481846
/*

0 commit comments

Comments
 (0)