]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm-vmscan-scale-number-of-pages-reclaimed-by-reclaim-compaction-based-on-failures-fix
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Sep 2012 00:19:09 +0000 (10:19 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 4 Oct 2012 05:03:12 +0000 (15:03 +1000)
fix build

Cc: Mel Gorman <mgorman@suse.de>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmscan.c

index 5228fc7492c2ebc2edb31a3ed7210b203cb33e57..f6fdae7a8d4c069e601c32b2179f2ff1b365d402 100644 (file)
@@ -1729,6 +1729,28 @@ static bool in_reclaim_compaction(struct scan_control *sc)
        return false;
 }
 
+#ifdef CONFIG_COMPACTION
+/*
+ * If compaction is deferred for sc->order then scale the number of pages
+ * reclaimed based on the number of consecutive allocation failures
+ */
+static unsigned long scale_for_compaction(unsigned long pages_for_compaction,
+                       struct lruvec *lruvec, struct scan_control *sc)
+{
+       struct zone *zone = lruvec_zone(lruvec);
+
+       if (zone->compact_order_failed <= sc->order)
+               pages_for_compaction <<= zone->compact_defer_shift;
+       return pages_for_compaction;
+}
+#else
+static unsigned long scale_for_compaction(unsigned long pages_for_compaction,
+                       struct lruvec *lruvec, struct scan_control *sc)
+{
+       return pages_for_compaction;
+}
+#endif
+
 /*
  * Reclaim/compaction is used for high-order allocation requests. It reclaims
  * order-0 pages before compacting the zone. should_continue_reclaim() returns
@@ -1743,7 +1765,6 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec,
 {
        unsigned long pages_for_compaction;
        unsigned long inactive_lru_pages;
-       struct zone *zone;
 
        /* If not in reclaim/compaction mode, stop */
        if (!in_reclaim_compaction(sc))
@@ -1778,14 +1799,8 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec,
         */
        pages_for_compaction = (2UL << sc->order);
 
-       /*
-        * If compaction is deferred for sc->order then scale the number of
-        * pages reclaimed based on the number of consecutive allocation
-        * failures
-        */
-       zone = lruvec_zone(lruvec);
-       if (zone->compact_order_failed <= sc->order)
-               pages_for_compaction <<= zone->compact_defer_shift;
+       pages_for_compaction = scale_for_compaction(pages_for_compaction,
+                                                   lruvec, sc);
        inactive_lru_pages = get_lru_size(lruvec, LRU_INACTIVE_FILE);
        if (nr_swap_pages > 0)
                inactive_lru_pages += get_lru_size(lruvec, LRU_INACTIVE_ANON);