All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
@ 2017-11-02 12:17 ` Vlastimil Babka
  0 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
order. When clearing pageblock skip bits for compaction, the bits are not
cleared for such pageblocks, because they cannot contain base pages suitable
for migration, nor free pages to use as migration targets.

This optimization can be simply extended to all compound pages of order equal
or larger than pageblock order, because migrating such pages (if they support
it) cannot help sub-pageblock fragmentation. This includes THP's and also
gigantic HugeTLB pages, which the current implementation doesn't persistently
skip due to a strict pageblock_order equality check and not recognizing tail
pages.

While THP pages are generally less "persistent" than HugeTLB, we can still
expect that if a THP exists at the point of __reset_isolation_suitable(), it
will exist also during the subsequent compaction run. The time difference here
could be actually smaller than between a compaction run that sets a
(non-persistent) skip bit on a THP, and the next compaction run that observes
it.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 445490ab2603..be7ab160f251 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -218,17 +218,21 @@ static void reset_cached_positions(struct zone *zone)
 }
 
 /*
- * Hugetlbfs pages should consistenly be skipped until updated by the hugetlb
- * subsystem.  It is always pointless to compact pages of pageblock_order and
- * the free scanner can reconsider when no longer huge.
+ * Compound pages of >= pageblock_order should consistenly be skipped until
+ * released. It is always pointless to compact pages of such order (if they are
+ * migratable), and the pageblocks they occupy cannot contain any free pages.
  */
-static bool pageblock_skip_persistent(struct page *page, unsigned int order)
+static bool pageblock_skip_persistent(struct page *page)
 {
-	if (!PageHuge(page))
+	if (!PageCompound(page))
 		return false;
-	if (order != pageblock_order)
-		return false;
-	return true;
+
+	page = compound_head(page);
+
+	if (compound_order(page) >= pageblock_order)
+		return true;
+
+	return false;
 }
 
 /*
@@ -255,7 +259,7 @@ static void __reset_isolation_suitable(struct zone *zone)
 			continue;
 		if (zone != page_zone(page))
 			continue;
-		if (pageblock_skip_persistent(page, compound_order(page)))
+		if (pageblock_skip_persistent(page))
 			continue;
 
 		clear_pageblock_skip(page);
@@ -322,8 +326,7 @@ static inline bool isolation_suitable(struct compact_control *cc,
 	return true;
 }
 
-static inline bool pageblock_skip_persistent(struct page *page,
-					     unsigned int order)
+static inline bool pageblock_skip_persistent(struct page *page)
 {
 	return false;
 }
-- 
2.14.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
@ 2017-11-02 12:17 ` Vlastimil Babka
  0 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
order. When clearing pageblock skip bits for compaction, the bits are not
cleared for such pageblocks, because they cannot contain base pages suitable
for migration, nor free pages to use as migration targets.

This optimization can be simply extended to all compound pages of order equal
or larger than pageblock order, because migrating such pages (if they support
it) cannot help sub-pageblock fragmentation. This includes THP's and also
gigantic HugeTLB pages, which the current implementation doesn't persistently
skip due to a strict pageblock_order equality check and not recognizing tail
pages.

While THP pages are generally less "persistent" than HugeTLB, we can still
expect that if a THP exists at the point of __reset_isolation_suitable(), it
will exist also during the subsequent compaction run. The time difference here
could be actually smaller than between a compaction run that sets a
(non-persistent) skip bit on a THP, and the next compaction run that observes
it.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 445490ab2603..be7ab160f251 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -218,17 +218,21 @@ static void reset_cached_positions(struct zone *zone)
 }
 
 /*
- * Hugetlbfs pages should consistenly be skipped until updated by the hugetlb
- * subsystem.  It is always pointless to compact pages of pageblock_order and
- * the free scanner can reconsider when no longer huge.
+ * Compound pages of >= pageblock_order should consistenly be skipped until
+ * released. It is always pointless to compact pages of such order (if they are
+ * migratable), and the pageblocks they occupy cannot contain any free pages.
  */
-static bool pageblock_skip_persistent(struct page *page, unsigned int order)
+static bool pageblock_skip_persistent(struct page *page)
 {
-	if (!PageHuge(page))
+	if (!PageCompound(page))
 		return false;
-	if (order != pageblock_order)
-		return false;
-	return true;
+
+	page = compound_head(page);
+
+	if (compound_order(page) >= pageblock_order)
+		return true;
+
+	return false;
 }
 
 /*
@@ -255,7 +259,7 @@ static void __reset_isolation_suitable(struct zone *zone)
 			continue;
 		if (zone != page_zone(page))
 			continue;
-		if (pageblock_skip_persistent(page, compound_order(page)))
+		if (pageblock_skip_persistent(page))
 			continue;
 
 		clear_pageblock_skip(page);
@@ -322,8 +326,7 @@ static inline bool isolation_suitable(struct compact_control *cc,
 	return true;
 }
 
-static inline bool pageblock_skip_persistent(struct page *page,
-					     unsigned int order)
+static inline bool pageblock_skip_persistent(struct page *page)
 {
 	return false;
 }
-- 
2.14.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/3] mm, compaction: split off flag for not updating skip hints
  2017-11-02 12:17 ` Vlastimil Babka
@ 2017-11-02 12:17   ` Vlastimil Babka
  -1 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

Pageblock skip hints were added as a heuristic for compaction, which shares
core code with CMA. Since CMA reliability would suffer from the heuristics,
compact_control flag ignore_skip_hint was added for the CMA use case.
Since commit 6815bf3f233e ("mm/compaction: respect ignore_skip_hint in
update_pageblock_skip") the flag also means that CMA won't *update* the skip
hints in addition to ignoring them.

Today, direct compaction can also ignore the skip hints in the last resort
attempt, but there's no reason not to set them when isolation fails in such
case. Thus, this patch splits off a new no_set_skip_hint flag to avoid the
updating, which only CMA sets. This should improve the heuristics a bit, and
allow us to simplify the persistent skip bit handling as the next step.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 2 +-
 mm/internal.h   | 1 +
 mm/page_alloc.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index be7ab160f251..a92860d89679 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -294,7 +294,7 @@ static void update_pageblock_skip(struct compact_control *cc,
 	struct zone *zone = cc->zone;
 	unsigned long pfn;
 
-	if (cc->ignore_skip_hint)
+	if (cc->no_set_skip_hint)
 		return;
 
 	if (!page)
diff --git a/mm/internal.h b/mm/internal.h
index 0aaa05af7833..3e5dc95dc259 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -201,6 +201,7 @@ struct compact_control {
 	const int classzone_idx;	/* zone index of a direct compactor */
 	enum migrate_mode mode;		/* Async or sync migration mode */
 	bool ignore_skip_hint;		/* Scan blocks even if marked skip */
+	bool no_set_skip_hint;		/* Don't mark blocks for skipping */
 	bool ignore_block_suitable;	/* Scan blocks considered unsuitable */
 	bool direct_compaction;		/* False from kcompactd or /proc/... */
 	bool whole_zone;		/* Whole zone should/has been scanned */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 67330a438525..79cdac1fee42 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7577,6 +7577,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
 		.zone = page_zone(pfn_to_page(start)),
 		.mode = MIGRATE_SYNC,
 		.ignore_skip_hint = true,
+		.no_set_skip_hint = true,
 		.gfp_mask = current_gfp_context(gfp_mask),
 	};
 	INIT_LIST_HEAD(&cc.migratepages);
-- 
2.14.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/3] mm, compaction: split off flag for not updating skip hints
@ 2017-11-02 12:17   ` Vlastimil Babka
  0 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

Pageblock skip hints were added as a heuristic for compaction, which shares
core code with CMA. Since CMA reliability would suffer from the heuristics,
compact_control flag ignore_skip_hint was added for the CMA use case.
Since commit 6815bf3f233e ("mm/compaction: respect ignore_skip_hint in
update_pageblock_skip") the flag also means that CMA won't *update* the skip
hints in addition to ignoring them.

Today, direct compaction can also ignore the skip hints in the last resort
attempt, but there's no reason not to set them when isolation fails in such
case. Thus, this patch splits off a new no_set_skip_hint flag to avoid the
updating, which only CMA sets. This should improve the heuristics a bit, and
allow us to simplify the persistent skip bit handling as the next step.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 2 +-
 mm/internal.h   | 1 +
 mm/page_alloc.c | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index be7ab160f251..a92860d89679 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -294,7 +294,7 @@ static void update_pageblock_skip(struct compact_control *cc,
 	struct zone *zone = cc->zone;
 	unsigned long pfn;
 
-	if (cc->ignore_skip_hint)
+	if (cc->no_set_skip_hint)
 		return;
 
 	if (!page)
diff --git a/mm/internal.h b/mm/internal.h
index 0aaa05af7833..3e5dc95dc259 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -201,6 +201,7 @@ struct compact_control {
 	const int classzone_idx;	/* zone index of a direct compactor */
 	enum migrate_mode mode;		/* Async or sync migration mode */
 	bool ignore_skip_hint;		/* Scan blocks even if marked skip */
+	bool no_set_skip_hint;		/* Don't mark blocks for skipping */
 	bool ignore_block_suitable;	/* Scan blocks considered unsuitable */
 	bool direct_compaction;		/* False from kcompactd or /proc/... */
 	bool whole_zone;		/* Whole zone should/has been scanned */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 67330a438525..79cdac1fee42 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7577,6 +7577,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
 		.zone = page_zone(pfn_to_page(start)),
 		.mode = MIGRATE_SYNC,
 		.ignore_skip_hint = true,
+		.no_set_skip_hint = true,
 		.gfp_mask = current_gfp_context(gfp_mask),
 	};
 	INIT_LIST_HEAD(&cc.migratepages);
-- 
2.14.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/3] mm, compaction: remove unneeded pageblock_skip_persistent() checks
  2017-11-02 12:17 ` Vlastimil Babka
@ 2017-11-02 12:17   ` Vlastimil Babka
  -1 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

Commit f3c931633a59 ("mm, compaction: persistently skip hugetlbfs pageblocks")
has introduced pageblock_skip_persistent() checks into migration and free
scanners, to make sure pageblocks that should be persistently skipped are
marked as such, regardless of the ignore_skip_hint flag.

Since the previous patch introduced a new no_set_skip_hint flag, the ignore flag
no longer prevents marking pageblocks as skipped. Therefore we can remove the
special cases. The relevant pageblocks will be marked as skipped by the common
logic which marks each pageblock where no page could be isolated. This makes the
code simpler.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index a92860d89679..b557aac09e92 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -475,10 +475,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
 		if (PageCompound(page)) {
 			const unsigned int order = compound_order(page);
 
-			if (pageblock_skip_persistent(page, order)) {
-				set_pageblock_skip(page);
-				blockpfn = end_pfn;
-			} else if (likely(order < MAX_ORDER)) {
+			if (likely(order < MAX_ORDER)) {
 				blockpfn += (1UL << order) - 1;
 				cursor += (1UL << order) - 1;
 			}
@@ -800,10 +797,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 		if (PageCompound(page)) {
 			const unsigned int order = compound_order(page);
 
-			if (pageblock_skip_persistent(page, order)) {
-				set_pageblock_skip(page);
-				low_pfn = end_pfn;
-			} else if (likely(order < MAX_ORDER))
+			if (likely(order < MAX_ORDER))
 				low_pfn += (1UL << order) - 1;
 			goto isolate_fail;
 		}
@@ -866,13 +860,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 			 * is safe to read and it's 0 for tail pages.
 			 */
 			if (unlikely(PageCompound(page))) {
-				const unsigned int order = compound_order(page);
-
-				if (pageblock_skip_persistent(page, order)) {
-					set_pageblock_skip(page);
-					low_pfn = end_pfn;
-				} else
-					low_pfn += (1UL << order) - 1;
+				low_pfn += (1UL << compound_order(page)) - 1;
 				goto isolate_fail;
 			}
 		}
-- 
2.14.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/3] mm, compaction: remove unneeded pageblock_skip_persistent() checks
@ 2017-11-02 12:17   ` Vlastimil Babka
  0 siblings, 0 replies; 12+ messages in thread
From: Vlastimil Babka @ 2017-11-02 12:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Mel Gorman, David Rientjes, Joonsoo Kim,
	Vlastimil Babka

Commit f3c931633a59 ("mm, compaction: persistently skip hugetlbfs pageblocks")
has introduced pageblock_skip_persistent() checks into migration and free
scanners, to make sure pageblocks that should be persistently skipped are
marked as such, regardless of the ignore_skip_hint flag.

Since the previous patch introduced a new no_set_skip_hint flag, the ignore flag
no longer prevents marking pageblocks as skipped. Therefore we can remove the
special cases. The relevant pageblocks will be marked as skipped by the common
logic which marks each pageblock where no page could be isolated. This makes the
code simpler.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 mm/compaction.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index a92860d89679..b557aac09e92 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -475,10 +475,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
 		if (PageCompound(page)) {
 			const unsigned int order = compound_order(page);
 
-			if (pageblock_skip_persistent(page, order)) {
-				set_pageblock_skip(page);
-				blockpfn = end_pfn;
-			} else if (likely(order < MAX_ORDER)) {
+			if (likely(order < MAX_ORDER)) {
 				blockpfn += (1UL << order) - 1;
 				cursor += (1UL << order) - 1;
 			}
@@ -800,10 +797,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 		if (PageCompound(page)) {
 			const unsigned int order = compound_order(page);
 
-			if (pageblock_skip_persistent(page, order)) {
-				set_pageblock_skip(page);
-				low_pfn = end_pfn;
-			} else if (likely(order < MAX_ORDER))
+			if (likely(order < MAX_ORDER))
 				low_pfn += (1UL << order) - 1;
 			goto isolate_fail;
 		}
@@ -866,13 +860,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 			 * is safe to read and it's 0 for tail pages.
 			 */
 			if (unlikely(PageCompound(page))) {
-				const unsigned int order = compound_order(page);
-
-				if (pageblock_skip_persistent(page, order)) {
-					set_pageblock_skip(page);
-					low_pfn = end_pfn;
-				} else
-					low_pfn += (1UL << order) - 1;
+				low_pfn += (1UL << compound_order(page)) - 1;
 				goto isolate_fail;
 			}
 		}
-- 
2.14.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
  2017-11-02 12:17 ` Vlastimil Babka
@ 2017-11-02 13:04   ` Mel Gorman
  -1 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2017-11-02 13:04 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, David Rientjes, Joonsoo Kim

On Thu, Nov 02, 2017 at 01:17:04PM +0100, Vlastimil Babka wrote:
> The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
> order. When clearing pageblock skip bits for compaction, the bits are not
> cleared for such pageblocks, because they cannot contain base pages suitable
> for migration, nor free pages to use as migration targets.
> 
> This optimization can be simply extended to all compound pages of order equal
> or larger than pageblock order, because migrating such pages (if they support
> it) cannot help sub-pageblock fragmentation. This includes THP's and also
> gigantic HugeTLB pages, which the current implementation doesn't persistently
> skip due to a strict pageblock_order equality check and not recognizing tail
> pages.
> 
> While THP pages are generally less "persistent" than HugeTLB, we can still
> expect that if a THP exists at the point of __reset_isolation_suitable(), it
> will exist also during the subsequent compaction run. The time difference here
> could be actually smaller than between a compaction run that sets a
> (non-persistent) skip bit on a THP, and the next compaction run that observes
> it.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
@ 2017-11-02 13:04   ` Mel Gorman
  0 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2017-11-02 13:04 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, David Rientjes, Joonsoo Kim

On Thu, Nov 02, 2017 at 01:17:04PM +0100, Vlastimil Babka wrote:
> The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
> order. When clearing pageblock skip bits for compaction, the bits are not
> cleared for such pageblocks, because they cannot contain base pages suitable
> for migration, nor free pages to use as migration targets.
> 
> This optimization can be simply extended to all compound pages of order equal
> or larger than pageblock order, because migrating such pages (if they support
> it) cannot help sub-pageblock fragmentation. This includes THP's and also
> gigantic HugeTLB pages, which the current implementation doesn't persistently
> skip due to a strict pageblock_order equality check and not recognizing tail
> pages.
> 
> While THP pages are generally less "persistent" than HugeTLB, we can still
> expect that if a THP exists at the point of __reset_isolation_suitable(), it
> will exist also during the subsequent compaction run. The time difference here
> could be actually smaller than between a compaction run that sets a
> (non-persistent) skip bit on a THP, and the next compaction run that observes
> it.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] mm, compaction: split off flag for not updating skip hints
  2017-11-02 12:17   ` Vlastimil Babka
@ 2017-11-02 13:09     ` Mel Gorman
  -1 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2017-11-02 13:09 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, David Rientjes, Joonsoo Kim

On Thu, Nov 02, 2017 at 01:17:05PM +0100, Vlastimil Babka wrote:
> Pageblock skip hints were added as a heuristic for compaction, which shares
> core code with CMA. Since CMA reliability would suffer from the heuristics,
> compact_control flag ignore_skip_hint was added for the CMA use case.
> Since commit 6815bf3f233e ("mm/compaction: respect ignore_skip_hint in
> update_pageblock_skip") the flag also means that CMA won't *update* the skip
> hints in addition to ignoring them.
> 
> Today, direct compaction can also ignore the skip hints in the last resort
> attempt, but there's no reason not to set them when isolation fails in such
> case. Thus, this patch splits off a new no_set_skip_hint flag to avoid the
> updating, which only CMA sets. This should improve the heuristics a bit, and
> allow us to simplify the persistent skip bit handling as the next step.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] mm, compaction: split off flag for not updating skip hints
@ 2017-11-02 13:09     ` Mel Gorman
  0 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2017-11-02 13:09 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, David Rientjes, Joonsoo Kim

On Thu, Nov 02, 2017 at 01:17:05PM +0100, Vlastimil Babka wrote:
> Pageblock skip hints were added as a heuristic for compaction, which shares
> core code with CMA. Since CMA reliability would suffer from the heuristics,
> compact_control flag ignore_skip_hint was added for the CMA use case.
> Since commit 6815bf3f233e ("mm/compaction: respect ignore_skip_hint in
> update_pageblock_skip") the flag also means that CMA won't *update* the skip
> hints in addition to ignoring them.
> 
> Today, direct compaction can also ignore the skip hints in the last resort
> attempt, but there's no reason not to set them when isolation fails in such
> case. Thus, this patch splits off a new no_set_skip_hint flag to avoid the
> updating, which only CMA sets. This should improve the heuristics a bit, and
> allow us to simplify the persistent skip bit handling as the next step.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
  2017-11-02 12:17 ` Vlastimil Babka
@ 2017-11-03 20:37   ` David Rientjes
  -1 siblings, 0 replies; 12+ messages in thread
From: David Rientjes @ 2017-11-03 20:37 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, Mel Gorman, Joonsoo Kim

On Thu, 2 Nov 2017, Vlastimil Babka wrote:

> The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
> order. When clearing pageblock skip bits for compaction, the bits are not
> cleared for such pageblocks, because they cannot contain base pages suitable
> for migration, nor free pages to use as migration targets.
> 
> This optimization can be simply extended to all compound pages of order equal
> or larger than pageblock order, because migrating such pages (if they support
> it) cannot help sub-pageblock fragmentation. This includes THP's and also
> gigantic HugeTLB pages, which the current implementation doesn't persistently
> skip due to a strict pageblock_order equality check and not recognizing tail
> pages.
> 
> While THP pages are generally less "persistent" than HugeTLB, we can still
> expect that if a THP exists at the point of __reset_isolation_suitable(), it
> will exist also during the subsequent compaction run. The time difference here
> could be actually smaller than between a compaction run that sets a
> (non-persistent) skip bit on a THP, and the next compaction run that observes
> it.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

This was originally done only for hugetlb because it was considered to be 
more persistent than thp, but with the presence of the deferred split 
shrinker I think this is fine.  It might be helpful to mention that the 
compound page is not synchronously split like it was prior to the thp 
refcounting patchset, however.

Acked-by: David Rientjes <rientjes@google.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages
@ 2017-11-03 20:37   ` David Rientjes
  0 siblings, 0 replies; 12+ messages in thread
From: David Rientjes @ 2017-11-03 20:37 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, linux-mm, linux-kernel, Mel Gorman, Joonsoo Kim

On Thu, 2 Nov 2017, Vlastimil Babka wrote:

> The pageblock_skip_persistent() function checks for HugeTLB pages of pageblock
> order. When clearing pageblock skip bits for compaction, the bits are not
> cleared for such pageblocks, because they cannot contain base pages suitable
> for migration, nor free pages to use as migration targets.
> 
> This optimization can be simply extended to all compound pages of order equal
> or larger than pageblock order, because migrating such pages (if they support
> it) cannot help sub-pageblock fragmentation. This includes THP's and also
> gigantic HugeTLB pages, which the current implementation doesn't persistently
> skip due to a strict pageblock_order equality check and not recognizing tail
> pages.
> 
> While THP pages are generally less "persistent" than HugeTLB, we can still
> expect that if a THP exists at the point of __reset_isolation_suitable(), it
> will exist also during the subsequent compaction run. The time difference here
> could be actually smaller than between a compaction run that sets a
> (non-persistent) skip bit on a THP, and the next compaction run that observes
> it.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>

This was originally done only for hugetlb because it was considered to be 
more persistent than thp, but with the presence of the deferred split 
shrinker I think this is fine.  It might be helpful to mention that the 
compound page is not synchronously split like it was prior to the thp 
refcounting patchset, however.

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-11-03 20:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 12:17 [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages Vlastimil Babka
2017-11-02 12:17 ` Vlastimil Babka
2017-11-02 12:17 ` [PATCH 2/3] mm, compaction: split off flag for not updating skip hints Vlastimil Babka
2017-11-02 12:17   ` Vlastimil Babka
2017-11-02 13:09   ` Mel Gorman
2017-11-02 13:09     ` Mel Gorman
2017-11-02 12:17 ` [PATCH 3/3] mm, compaction: remove unneeded pageblock_skip_persistent() checks Vlastimil Babka
2017-11-02 12:17   ` Vlastimil Babka
2017-11-02 13:04 ` [PATCH 1/3] mm, compaction: extend pageblock_skip_persistent() to all compound pages Mel Gorman
2017-11-02 13:04   ` Mel Gorman
2017-11-03 20:37 ` David Rientjes
2017-11-03 20:37   ` David Rientjes

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.