]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - mm/vmscan.c
vmscan: limit direct reclaim for higher order allocations
[karo-tx-linux.git] / mm / vmscan.c
index f51a33e8ed89111089b35dee6b3a6f7d084b07e7..7e0f0579738889c092d00834519cabe0b552a527 100644 (file)
@@ -2125,6 +2125,22 @@ static void shrink_zones(int priority, struct zonelist *zonelist,
                                continue;
                        if (zone->all_unreclaimable && priority != DEF_PRIORITY)
                                continue;       /* Let kswapd poll it */
+                       if (COMPACTION_BUILD) {
+                               /*
+                                * If we already have plenty of memory
+                                * free for compaction, don't free any
+                                * more.  Even though compaction is
+                                * invoked for any non-zero order,
+                                * only frequent costly order
+                                * reclamation is disruptive enough to
+                                * become a noticable problem, like
+                                * transparent huge page allocations.
+                                */
+                               if (sc->order > PAGE_ALLOC_COSTLY_ORDER &&
+                                       (compaction_suitable(zone, sc->order) ||
+                                        compaction_deferred(zone)))
+                                       continue;
+                       }
                        /*
                         * This steals pages from memory cgroups over softlimit
                         * and returns the number of reclaimed pages and