aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorJohannes Weiner <jweiner@redhat.com>2011-09-14 19:21:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-09-14 21:09:37 -0400
commita4d3e9e76337059406fcf3ead288c0df22a790e9 (patch)
treea0213478caaa3845bf62a4cbe6b65979be5e34b4 /mm/vmscan.c
parentd4c32f355cec2647efb65e4b24e630bd2386f787 (diff)
mm: vmscan: fix force-scanning small targets without swap
Without swap, anonymous pages are not scanned. As such, they should not count when considering force-scanning a small target if there is no swap. Otherwise, targets are not force-scanned even when their effective scan number is zero and the other conditions--kswapd/memcg--apply. This fixes 246e87a93934 ("memcg: fix get_scan_count() for small targets"). [akpm@linux-foundation.org: fix comment] Signed-off-by: Johannes Weiner <jweiner@redhat.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: Michal Hocko <mhocko@suse.cz> Cc: Ying Han <yinghan@google.com> Cc: Balbir Singh <bsingharora@gmail.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Acked-by: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b7719ec10dc5..e49bcb6d4948 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1808,23 +1808,15 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
1808 u64 fraction[2], denominator; 1808 u64 fraction[2], denominator;
1809 enum lru_list l; 1809 enum lru_list l;
1810 int noswap = 0; 1810 int noswap = 0;
1811 int force_scan = 0; 1811 bool force_scan = false;
1812 unsigned long nr_force_scan[2]; 1812 unsigned long nr_force_scan[2];
1813 1813
1814 1814 /* kswapd does zone balancing and needs to scan this zone */
1815 anon = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) + 1815 if (scanning_global_lru(sc) && current_is_kswapd())
1816 zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON); 1816 force_scan = true;
1817 file = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) + 1817 /* memcg may have small limit and need to avoid priority drop */
1818 zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE); 1818 if (!scanning_global_lru(sc))
1819 1819 force_scan = true;
1820 if (((anon + file) >> priority) < SWAP_CLUSTER_MAX) {
1821 /* kswapd does zone balancing and need to scan this zone */
1822 if (scanning_global_lru(sc) && current_is_kswapd())
1823 force_scan = 1;
1824 /* memcg may have small limit and need to avoid priority drop */
1825 if (!scanning_global_lru(sc))
1826 force_scan = 1;
1827 }
1828 1820
1829 /* If we have no swap space, do not bother scanning anon pages. */ 1821 /* If we have no swap space, do not bother scanning anon pages. */
1830 if (!sc->may_swap || (nr_swap_pages <= 0)) { 1822 if (!sc->may_swap || (nr_swap_pages <= 0)) {
@@ -1837,6 +1829,11 @@ static void get_scan_count(struct zone *zone, struct scan_control *sc,
1837 goto out; 1829 goto out;
1838 } 1830 }
1839 1831
1832 anon = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) +
1833 zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
1834 file = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) +
1835 zone_nr_lru_pages(zone, sc, LRU_INACTIVE_FILE);
1836
1840 if (scanning_global_lru(sc)) { 1837 if (scanning_global_lru(sc)) {
1841 free = zone_page_state(zone, NR_FREE_PAGES); 1838 free = zone_page_state(zone, NR_FREE_PAGES);
1842 /* If we have very few page cache pages, 1839 /* If we have very few page cache pages,