mm: thp: replace DEBUG_VM BUG with VM_WARN when unmap fails for split

When debugging the bug reported by Wang Yugui [1], try_to_unmap() may
fail, but the first VM_BUG_ON_PAGE() just checks page_mapcount() however
it may miss the failure when head page is unmapped but other subpage is
mapped.  Then the second DEBUG_VM BUG() that check total mapcount would
catch it.  This may incur some confusion.

As this is not a fatal issue, so consolidate the two DEBUG_VM checks
into one VM_WARN_ON_ONCE_PAGE().


Signed-off-by: Yang Shi <>
Reviewed-by: Zi Yan <>
Acked-by: Kirill A. Shutemov <>
Signed-off-by: Hugh Dickins <>
Cc: Alistair Popple <>
Cc: Jan Kara <>
Cc: Jue Wang <>
Cc: "Matthew Wilcox (Oracle)" <>
Cc: Miaohe Lin <>
Cc: Minchan Kim <>
Cc: Naoya Horiguchi <>
Cc: Oscar Salvador <>
Cc: Peter Xu <>
Cc: Ralph Campbell <>
Cc: Shakeel Butt <>
Cc: Wang Yugui <>
Cc: <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
1 file changed