From 81045b9646b1751731e8e447f02b2359faeb32e6 Mon Sep 17 00:00:00 2001 From: Vlastimil Babka Date: Sat, 10 Sep 2016 20:34:05 +1000 Subject: [PATCH] mm-compaction-create-compact_gap-wrapper-fix Clarify the comment of compact_gap() wrt COMPACT_CLUSTER_MAX, per Joonsoo. Link: http://lkml.kernel.org/r/7b6aed1f-fdf8-2063-9ff4-bbe4de712d37@suse.cz Signed-off-by: Vlastimil Babka Cc: Joonsoo Kim Cc: Michal Hocko Cc: Mel Gorman Cc: David Rientjes Cc: Rik van Riel Signed-off-by: Andrew Morton --- include/linux/compaction.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/include/linux/compaction.h b/include/linux/compaction.h index e7f0d34a90fe..585d55cb0dc0 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -67,9 +67,16 @@ static inline unsigned long compact_gap(unsigned int order) { /* * Although all the isolations for migration are temporary, compaction - * may have up to 1 << order pages on its list and then try to split - * an (order - 1) free page. At that point, a gap of 1 << order might - * not be enough, so it's safer to require twice that amount. + * free scanner may have up to 1 << order pages on its list and then + * try to split an (order - 1) free page. At that point, a gap of + * 1 << order might not be enough, so it's safer to require twice that + * amount. Note that the number of pages on the list is also + * effectively limited by COMPACT_CLUSTER_MAX, as that's the maximum + * that the migrate scanner can have isolated on migrate list, and free + * scanner is only invoked when the number of isolated free pages is + * lower than that. But it's not worth to complicate the formula here + * as a bigger gap for higher orders than strictly necessary can also + * improve chances of compaction success. */ return 2UL << order; } -- 2.34.1