Commit 0783ac95 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

mm/shmem: fix build without THP

Some optimizers don't notice that shmem_punch_compound() is always true
(PageTransCompound() being false) without CONFIG_TRANSPARENT_HUGEPAGE==y.

Use IS_ENABLED to help them to avoid the BUILD_BUG inside HPAGE_PMD_NR.

Fixes: 71725ed1 ("mm: huge tmpfs: try to split_huge_page() when punching hole")
Reported-by: default avatarRandy Dunlap <>
Signed-off-by: default avatarHugh Dickins <>
Signed-off-by: default avatarAndrew Morton <>
Tested-by: default avatarRandy Dunlap <>
Acked-by: default avatarRandy Dunlap <>
Link: default avatarLinus Torvalds <>
parent 56df70a6
......@@ -952,7 +952,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
VM_BUG_ON_PAGE(PageWriteback(page), page);
if (shmem_punch_compound(page, start, end))
truncate_inode_page(mapping, page);
else {
/* Wipe the page and don't get stuck */
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment