mm, compaction: restrict full priority to non-costly orders
authorVlastimil Babka <vbabka@suse.cz>
Sat, 10 Sep 2016 10:34:15 +0000 (20:34 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 10 Sep 2016 10:34:15 +0000 (20:34 +1000)
The new ultimate compaction priority disables some heuristics, which may
result in excessive cost.  This is fine for non-costly orders where we
want to try hard before resulting for OOM, but might be disruptive for
costly orders which do not trigger OOM and should generally have some
fallback.  Thus, we disable the full priority for costly orders.

Suggested-by: Michal Hocko <mhocko@kernel.org>
Link: http://lkml.kernel.org/r/20160906135258.18335-4-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/compaction.h
mm/page_alloc.c

index 585d55cb0dc02078791830ec2d181a819fb29d29..0d8415820fc35409fbabcbef3bfe05c4cfa99546 100644 (file)
@@ -9,6 +9,7 @@ enum compact_priority {
        COMPACT_PRIO_SYNC_FULL,
        MIN_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_FULL,
        COMPACT_PRIO_SYNC_LIGHT,
+       MIN_COMPACT_COSTLY_PRIORITY = COMPACT_PRIO_SYNC_LIGHT,
        DEF_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_LIGHT,
        COMPACT_PRIO_ASYNC,
        INIT_COMPACT_PRIORITY = COMPACT_PRIO_ASYNC
index cf2c989528bb1b7fe7816430f2f6bf8168621cbf..ce03c930ffcf169923c111169061280524aead86 100644 (file)
@@ -3163,6 +3163,7 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
                     int compaction_retries)
 {
        int max_retries = MAX_COMPACT_RETRIES;
+       int min_priority;
 
        if (!order)
                return false;
@@ -3202,7 +3203,9 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags,
         * if we exhausted all retries at the lower priorities
         */
 check_priority:
-       if (*compact_priority > MIN_COMPACT_PRIORITY) {
+       min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ?
+                       MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY;
+       if (*compact_priority > min_priority) {
                (*compact_priority)--;
                return true;
        }
This page took 0.036765 seconds and 5 git commands to generate.