mm: vmscan: treat pages marked for immediate reclaim as zone congestion
authorMel Gorman <[email protected]>
Wed, 3 Jul 2013 22:02:03 +0000 (15:02 -0700)
committerLinus Torvalds <[email protected]>
Wed, 3 Jul 2013 23:07:29 +0000 (16:07 -0700)
Currently a zone will only be marked congested if the underlying BDI is
congested but if dirty pages are spread across zones it is possible that
an individual zone is full of dirty pages without being congested.  The
impact is that zone gets scanned very quickly potentially reclaiming
really clean pages.  This patch treats pages marked for immediate
reclaim as congested for the purposes of marking a zone ZONE_CONGESTED
and stalling in wait_iff_congested.

Signed-off-by: Mel Gorman <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Valdis Kletnieks <[email protected]>
Cc: Zlatko Calusic <[email protected]>
Cc: dormando <[email protected]>
Cc: Trond Myklebust <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/vmscan.c

index 4898daf074cfa88e7047d5a301d65d6db7367258..bf4778479e3a498b02da17379c59b1639a59ad6b 100644 (file)
@@ -761,9 +761,15 @@ static unsigned long shrink_page_list(struct list_head *page_list,
                if (dirty && !writeback)
                        nr_unqueued_dirty++;
 
-               /* Treat this page as congested if underlying BDI is */
+               /*
+                * Treat this page as congested if the underlying BDI is or if
+                * pages are cycling through the LRU so quickly that the
+                * pages marked for immediate reclaim are making it to the
+                * end of the LRU a second time.
+                */
                mapping = page_mapping(page);
-               if (mapping && bdi_write_congested(mapping->backing_dev_info))
+               if ((mapping && bdi_write_congested(mapping->backing_dev_info)) ||
+                   (writeback && PageReclaim(page)))
                        nr_congested++;
 
                /*