From: David Hildenbrand david@redhat.com
mainline inclusion from mainline-v5.19-rc1 commit 500539419fae0aeb27189b2d62a238a056ca6742 category: bugfix bugzilla: 187533, https://gitee.com/openeuler/kernel/issues/I5OITX CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
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.
Link: https://lkml.kernel.org/r/20220428083441.37290-11-david@redhat.com Signed-off-by: David Hildenbrand david@redhat.com Reported-by: Yang Shi shy828301@gmail.com Reviewed-by: Yang Shi shy828301@gmail.com Acked-by: Vlastimil Babka vbabka@suse.cz Cc: Andrea Arcangeli aarcange@redhat.com Cc: Christoph Hellwig hch@lst.de Cc: David Rientjes rientjes@google.com Cc: Don Dutile ddutile@redhat.com Cc: Hugh Dickins hughd@google.com Cc: Jan Kara jack@suse.cz Cc: Jann Horn jannh@google.com Cc: Jason Gunthorpe jgg@nvidia.com Cc: John Hubbard jhubbard@nvidia.com Cc: Khalid Aziz khalid.aziz@oracle.com Cc: "Kirill A. Shutemov" kirill.shutemov@linux.intel.com Cc: Liang Zhang zhangliang5@huawei.com Cc: "Matthew Wilcox (Oracle)" willy@infradead.org Cc: Michal Hocko mhocko@kernel.org Cc: Mike Kravetz mike.kravetz@oracle.com Cc: Mike Rapoport rppt@linux.ibm.com Cc: Nadav Amit namit@vmware.com Cc: Oded Gabbay oded.gabbay@gmail.com Cc: Oleg Nesterov oleg@redhat.com Cc: Pedro Demarchi Gomes pedrodemargomes@gmail.com Cc: Peter Xu peterx@redhat.com Cc: Rik van Riel riel@surriel.com Cc: Roman Gushchin guro@fb.com Cc: Shakeel Butt shakeelb@google.com Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Ma Wupeng mawupeng1@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- mm/huge_memory.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 79c855b5adad..012ecf107ae0 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2374,8 +2374,6 @@ static void unmap_page(struct page *page) ttu_flags |= TTU_SPLIT_FREEZE;
try_to_unmap(page, ttu_flags); - - VM_WARN_ON_ONCE_PAGE(page_mapped(page), page); }
static void remap_page(struct page *page, unsigned int nr)