diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-05 10:35:29 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-05 10:35:29 -0400 |
commit | cc44826a26b12b2489bc7dbb597fcdf107f2cc01 (patch) | |
tree | 98a7958212ac61345300944f512a949e5ee3e513 /mm/vmscan.c | |
parent | 482e6f8466ab1066f1a969bcdbe916b56439622c (diff) | |
parent | 7f0d384cafabfbb56663ee6944c18fc0450fc5d6 (diff) |
Merge branch 'master' into for-linus
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 915dceb487c1..9c7e57cc63a3 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1724,13 +1724,13 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1724 | * If a zone is deemed to be full of pinned pages then just give it a light | 1724 | * If a zone is deemed to be full of pinned pages then just give it a light |
1725 | * scan then give up on it. | 1725 | * scan then give up on it. |
1726 | */ | 1726 | */ |
1727 | static int shrink_zones(int priority, struct zonelist *zonelist, | 1727 | static bool shrink_zones(int priority, struct zonelist *zonelist, |
1728 | struct scan_control *sc) | 1728 | struct scan_control *sc) |
1729 | { | 1729 | { |
1730 | enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask); | 1730 | enum zone_type high_zoneidx = gfp_zone(sc->gfp_mask); |
1731 | struct zoneref *z; | 1731 | struct zoneref *z; |
1732 | struct zone *zone; | 1732 | struct zone *zone; |
1733 | int progress = 0; | 1733 | bool all_unreclaimable = true; |
1734 | 1734 | ||
1735 | for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx, | 1735 | for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx, |
1736 | sc->nodemask) { | 1736 | sc->nodemask) { |
@@ -1757,9 +1757,9 @@ static int shrink_zones(int priority, struct zonelist *zonelist, | |||
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | shrink_zone(priority, zone, sc); | 1759 | shrink_zone(priority, zone, sc); |
1760 | progress = 1; | 1760 | all_unreclaimable = false; |
1761 | } | 1761 | } |
1762 | return progress; | 1762 | return all_unreclaimable; |
1763 | } | 1763 | } |
1764 | 1764 | ||
1765 | /* | 1765 | /* |
@@ -1782,7 +1782,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1782 | struct scan_control *sc) | 1782 | struct scan_control *sc) |
1783 | { | 1783 | { |
1784 | int priority; | 1784 | int priority; |
1785 | unsigned long ret = 0; | 1785 | bool all_unreclaimable; |
1786 | unsigned long total_scanned = 0; | 1786 | unsigned long total_scanned = 0; |
1787 | struct reclaim_state *reclaim_state = current->reclaim_state; | 1787 | struct reclaim_state *reclaim_state = current->reclaim_state; |
1788 | unsigned long lru_pages = 0; | 1788 | unsigned long lru_pages = 0; |
@@ -1813,7 +1813,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1813 | sc->nr_scanned = 0; | 1813 | sc->nr_scanned = 0; |
1814 | if (!priority) | 1814 | if (!priority) |
1815 | disable_swap_token(); | 1815 | disable_swap_token(); |
1816 | ret = shrink_zones(priority, zonelist, sc); | 1816 | all_unreclaimable = shrink_zones(priority, zonelist, sc); |
1817 | /* | 1817 | /* |
1818 | * Don't shrink slabs when reclaiming memory from | 1818 | * Don't shrink slabs when reclaiming memory from |
1819 | * over limit cgroups | 1819 | * over limit cgroups |
@@ -1826,10 +1826,8 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1826 | } | 1826 | } |
1827 | } | 1827 | } |
1828 | total_scanned += sc->nr_scanned; | 1828 | total_scanned += sc->nr_scanned; |
1829 | if (sc->nr_reclaimed >= sc->nr_to_reclaim) { | 1829 | if (sc->nr_reclaimed >= sc->nr_to_reclaim) |
1830 | ret = sc->nr_reclaimed; | ||
1831 | goto out; | 1830 | goto out; |
1832 | } | ||
1833 | 1831 | ||
1834 | /* | 1832 | /* |
1835 | * Try to write back as many pages as we just scanned. This | 1833 | * Try to write back as many pages as we just scanned. This |
@@ -1849,9 +1847,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1849 | priority < DEF_PRIORITY - 2) | 1847 | priority < DEF_PRIORITY - 2) |
1850 | congestion_wait(BLK_RW_ASYNC, HZ/10); | 1848 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1851 | } | 1849 | } |
1852 | /* top priority shrink_zones still had more to do? don't OOM, then */ | 1850 | |
1853 | if (ret && scanning_global_lru(sc)) | ||
1854 | ret = sc->nr_reclaimed; | ||
1855 | out: | 1851 | out: |
1856 | /* | 1852 | /* |
1857 | * Now that we've scanned all the zones at this priority level, note | 1853 | * Now that we've scanned all the zones at this priority level, note |
@@ -1877,7 +1873,14 @@ out: | |||
1877 | delayacct_freepages_end(); | 1873 | delayacct_freepages_end(); |
1878 | put_mems_allowed(); | 1874 | put_mems_allowed(); |
1879 | 1875 | ||
1880 | return ret; | 1876 | if (sc->nr_reclaimed) |
1877 | return sc->nr_reclaimed; | ||
1878 | |||
1879 | /* top priority shrink_zones still had more to do? don't OOM, then */ | ||
1880 | if (scanning_global_lru(sc) && !all_unreclaimable) | ||
1881 | return 1; | ||
1882 | |||
1883 | return 0; | ||
1881 | } | 1884 | } |
1882 | 1885 | ||
1883 | unsigned long try_to_free_pages(struct zonelist *zonelist, int order, | 1886 | unsigned long try_to_free_pages(struct zonelist *zonelist, int order, |