Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199824
b: refs/heads/master
c: bb21c7c
h: refs/heads/master
v: v3
  • Loading branch information
KOSAKI Motohiro authored and Linus Torvalds committed Jun 4, 2010
1 parent c458df7 commit 9cb3630
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9e506f7adce8e6165a104d3d78fddd8ff0cdccf8
refs/heads/master: bb21c7ce18eff8e6e7877ca1d06c6db719376e3c
29 changes: 16 additions & 13 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,13 +1724,13 @@ static void shrink_zone(int priority, struct zone *zone,
* If a zone is deemed to be full of pinned pages then just give it a light
* scan then give up on it.
*/
static int shrink_zones(int priority, struct zonelist *zonelist,
static bool shrink_zones(int priority, struct zonelist *zonelist,
struct scan_control *sc)
{
enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask);
struct zoneref *z;
struct zone *zone;
int progress = 0;
bool all_unreclaimable = true;

for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
sc->nodemask) {
Expand All @@ -1757,9 +1757,9 @@ static int shrink_zones(int priority, struct zonelist *zonelist,
}

shrink_zone(priority, zone, sc);
progress = 1;
all_unreclaimable = false;
}
return progress;
return all_unreclaimable;
}

/*
Expand All @@ -1782,7 +1782,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
struct scan_control *sc)
{
int priority;
unsigned long ret = 0;
bool all_unreclaimable;
unsigned long total_scanned = 0;
struct reclaim_state *reclaim_state = current->reclaim_state;
unsigned long lru_pages = 0;
Expand Down Expand Up @@ -1813,7 +1813,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
sc->nr_scanned = 0;
if (!priority)
disable_swap_token();
ret = shrink_zones(priority, zonelist, sc);
all_unreclaimable = shrink_zones(priority, zonelist, sc);
/*
* Don't shrink slabs when reclaiming memory from
* over limit cgroups
Expand All @@ -1826,10 +1826,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
}
}
total_scanned += sc->nr_scanned;
if (sc->nr_reclaimed >= sc->nr_to_reclaim) {
ret = sc->nr_reclaimed;
if (sc->nr_reclaimed >= sc->nr_to_reclaim)
goto out;
}

/*
* Try to write back as many pages as we just scanned. This
Expand All @@ -1849,9 +1847,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
priority < DEF_PRIORITY - 2)
congestion_wait(BLK_RW_ASYNC, HZ/10);
}
/* top priority shrink_zones still had more to do? don't OOM, then */
if (ret && scanning_global_lru(sc))
ret = sc->nr_reclaimed;

out:
/*
* Now that we've scanned all the zones at this priority level, note
Expand All @@ -1877,7 +1873,14 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
delayacct_freepages_end();
put_mems_allowed();

return ret;
if (sc->nr_reclaimed)
return sc->nr_reclaimed;

/* top priority shrink_zones still had more to do? don't OOM, then */
if (scanning_global_lru(sc) && !all_unreclaimable)
return 1;

return 0;
}

unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
Expand Down

0 comments on commit 9cb3630

Please sign in to comment.