diff mbox series

[v3,10/16] mm/huge_memory: remove outdated VM_WARN_ON_ONCE_PAGE from unmap_page()

Message ID 20220329160440.193848-11-david@redhat.com (mailing list archive)
State New
Headers show
Series mm: COW fixes part 2: reliable GUP pins of anonymous pages | expand

Commit Message

David Hildenbrand March 29, 2022, 4:04 p.m. UTC
We can already theoretically fail to unmap (still having page_mapped()) in
case arch_unmap_one() fails, which can happen on sparc. Failures to
unmap are handled gracefully, just as if there are other references on
the target page: freezing the refcount in split_huge_page_to_list()
will fail if still mapped and we'll simply remap.

In commit 504e070dc08f ("mm: thp: replace DEBUG_VM BUG with VM_WARN when
unmap fails for split") we already converted to VM_WARN_ON_ONCE_PAGE,
let's get rid of it completely now.

This is a preparation for making try_to_migrate() fail on anonymous pages
with GUP pins, which will make this VM_WARN_ON_ONCE_PAGE trigger more
frequently.

Reported-by: Yang Shi <shy828301@gmail.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 mm/huge_memory.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Vlastimil Babka April 12, 2022, 9:37 a.m. UTC | #1
On 3/29/22 18:04, David Hildenbrand wrote:
> We can already theoretically fail to unmap (still having page_mapped()) in
> case arch_unmap_one() fails, which can happen on sparc. Failures to
> unmap are handled gracefully, just as if there are other references on
> the target page: freezing the refcount in split_huge_page_to_list()
> will fail if still mapped and we'll simply remap.
> 
> In commit 504e070dc08f ("mm: thp: replace DEBUG_VM BUG with VM_WARN when
> unmap fails for split") we already converted to VM_WARN_ON_ONCE_PAGE,
> let's get rid of it completely now.
> 
> This is a preparation for making try_to_migrate() fail on anonymous pages
> with GUP pins, which will make this VM_WARN_ON_ONCE_PAGE trigger more
> frequently.
> 
> Reported-by: Yang Shi <shy828301@gmail.com>
> Reviewed-by: Yang Shi <shy828301@gmail.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/huge_memory.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index dd16819c5edc..70298431e128 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2241,8 +2241,6 @@ static void unmap_page(struct page *page)
>  		try_to_migrate(folio, ttu_flags);
>  	else
>  		try_to_unmap(folio, ttu_flags | TTU_IGNORE_MLOCK);
> -
> -	VM_WARN_ON_ONCE_PAGE(page_mapped(page), page);
>  }
>  
>  static void remap_page(struct folio *folio, unsigned long nr)
diff mbox series

Patch

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index dd16819c5edc..70298431e128 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2241,8 +2241,6 @@  static void unmap_page(struct page *page)
 		try_to_migrate(folio, ttu_flags);
 	else
 		try_to_unmap(folio, ttu_flags | TTU_IGNORE_MLOCK);
-
-	VM_WARN_ON_ONCE_PAGE(page_mapped(page), page);
 }
 
 static void remap_page(struct folio *folio, unsigned long nr)