mm/khugepaged: collapse_shmem() stop if punched or truncated

Huge tmpfs testing showed that although collapse_shmem() recognizes a
concurrently truncated or hole-punched page correctly, its handling of
holes was liable to refill an emptied extent.  Add check to stop that.

Fixes: f3f0e1d2150b2 ("khugepaged: add support of collapse for tmpfs/shmem pages")
Signed-off-by: Hugh Dickins <>
Reviewed-by: Matthew Wilcox <>
Cc: Kirill A. Shutemov <>
Cc: Jerome Glisse <>
Cc: Konstantin Khlebnikov <>
Cc: <>	[4.8+]
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
1 file changed