Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm, compaction: restrict full priority to non-costly orders

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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Vlastimil Babka and committed by
Linus Torvalds
c2033b00 d9436498

+5 -1
+1
include/linux/compaction.h
··· 9 9 COMPACT_PRIO_SYNC_FULL, 10 10 MIN_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_FULL, 11 11 COMPACT_PRIO_SYNC_LIGHT, 12 + MIN_COMPACT_COSTLY_PRIORITY = COMPACT_PRIO_SYNC_LIGHT, 12 13 DEF_COMPACT_PRIORITY = COMPACT_PRIO_SYNC_LIGHT, 13 14 COMPACT_PRIO_ASYNC, 14 15 INIT_COMPACT_PRIORITY = COMPACT_PRIO_ASYNC
+4 -1
mm/page_alloc.c
··· 3163 3163 int *compaction_retries) 3164 3164 { 3165 3165 int max_retries = MAX_COMPACT_RETRIES; 3166 + int min_priority; 3166 3167 3167 3168 if (!order) 3168 3169 return false; ··· 3206 3205 * all retries or failed at the lower priorities. 3207 3206 */ 3208 3207 check_priority: 3209 - if (*compact_priority > MIN_COMPACT_PRIORITY) { 3208 + min_priority = (order > PAGE_ALLOC_COSTLY_ORDER) ? 3209 + MIN_COMPACT_COSTLY_PRIORITY : MIN_COMPACT_PRIORITY; 3210 + if (*compact_priority > min_priority) { 3210 3211 (*compact_priority)--; 3211 3212 *compaction_retries = 0; 3212 3213 return true;