Skip to contentSkip to conversation

rmap: Fix compound check logic in page_remove_file_rmap

PATCH Applied Steve Capper 2 participants 2 messages Aug 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rmap: Fix compound check logic in page_remove_file_rmap

In page_remove_file_rmap(.) we have the following check:
VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);

This is meant to check for either HugeTLB pages or THP when a compound page is passed in.

Unfortunately, if one disables CONFIG_TRANSPARENT_HUGEPAGE, then PageTransHuge(.) will always return false, provoking BUGs when one runs the libhugetlbfs test suite.

This patch replaces PageTransHuge(), with PageHead() which will work for both HugeTLB and THP.

Fixes dd78fedde4b9 ("rmap: support file thp")
Cc Kirill A. Shutemov <[email protected]>
Cc Andrew Morton <[email protected]>

---

v2 - switch to PageHead as suggested by Kirill.

---
 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/rmap.c +1 -1
index 709bc83..1180340 100644
@@ -1303,7 +1303,7 @@ static void page_remove_file_rmap(struct page *page, bool compound)
 {
 	int i, nr = 1;
 
-	VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);
+	VM_BUG_ON_PAGE(compound && !PageHead(page), page);
 	lock_page_memcg(page);
 
 	/* Hugepages are not counted in NR_FILE_MAPPED for now. */
Signature · 7 lines
1.8.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Acked-by on v2 1/1
#1 lore raw
Quoted 10 lines · Steve Capper

In page_remove_file_rmap(.) we have the following check:
VM_BUG_ON_PAGE(compound && !PageTransHuge(page), page);

This is meant to check for either HugeTLB pages or THP when a compound page is passed in.

Unfortunately, if one disables CONFIG_TRANSPARENT_HUGEPAGE, then PageTransHuge(.) will always return false, provoking BUGs when one runs the libhugetlbfs test suite.

Quoted 7 lines

This patch replaces PageTransHuge(), with PageHead() which will work for both HugeTLB and THP.

Fixes dd78fedde4b9 ("rmap: support file thp")
Cc Kirill A. Shutemov <[email protected]>
Cc Andrew Morton <[email protected]>
Signature · 7 lines
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>