diff mbox series

mm: Improve the comment in isolate_migratepages_block()

Message ID ZMLWEB4m3zvX6SBN@casper.infradead.org (mailing list archive)
State New
Headers show
Series mm: Improve the comment in isolate_migratepages_block() | expand

Commit Message

Matthew Wilcox July 27, 2023, 8:39 p.m. UTC
A recent patch shows that not everybody understands that "stabilise the
mapping" really means "prevent the mapping from being freed", so change
the wording to hopefully make that more clear.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Comments

David Hildenbrand July 27, 2023, 9:10 p.m. UTC | #1
On 27.07.23 22:39, Matthew Wilcox wrote:
> A recent patch shows that not everybody understands that "stabilise the
> mapping" really means "prevent the mapping from being freed", so change
> the wording to hopefully make that more clear.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> 
> diff --git a/mm/compaction.c b/mm/compaction.c
> index 9641e2131901..9be2c3504ff2 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -1095,13 +1095,13 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>   			bool migrate_dirty;
>   
>   			/*
> -			 * Only pages without mappings or that have a
> -			 * ->migrate_folio callback are possible to migrate
> -			 * without blocking. However, we can be racing with
> -			 * truncation so it's necessary to lock the page
> -			 * to stabilise the mapping as truncation holds
> -			 * the page lock until after the page is removed
> -			 * from the page cache.
> +			 * Only folios without mappings or that have
> +			 * a ->migrate_folio callback are possible to
> +			 * migrate without blocking.  However, we may
> +			 * be racing with truncation, which can free
> +			 * the mapping.  Truncation holds the folio lock
> +			 * until after the folio is removed from the page
> +			 * cache so holding it ourselves is sufficient.
>   			 */
>   			if (!folio_trylock(folio))
>   				goto isolate_fail_put;
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/compaction.c b/mm/compaction.c
index 9641e2131901..9be2c3504ff2 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1095,13 +1095,13 @@  isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
 			bool migrate_dirty;
 
 			/*
-			 * Only pages without mappings or that have a
-			 * ->migrate_folio callback are possible to migrate
-			 * without blocking. However, we can be racing with
-			 * truncation so it's necessary to lock the page
-			 * to stabilise the mapping as truncation holds
-			 * the page lock until after the page is removed
-			 * from the page cache.
+			 * Only folios without mappings or that have
+			 * a ->migrate_folio callback are possible to
+			 * migrate without blocking.  However, we may
+			 * be racing with truncation, which can free
+			 * the mapping.  Truncation holds the folio lock
+			 * until after the folio is removed from the page
+			 * cache so holding it ourselves is sufficient.
 			 */
 			if (!folio_trylock(folio))
 				goto isolate_fail_put;