linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rmap: Fix compound check logic in page_remove_file_rmap
@ 2016-08-09 12:34 Steve Capper
  2016-08-09 16:29 ` Kirill A. Shutemov
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Capper @ 2016-08-09 12:34 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, shijie.huang, will.deacon, catalin.marinas

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.

Changing the definition of PageTransHuge to be defined for
!CONFIG_TRANSPARENT_HUGEPAGE turned out to provoke build bugs; so this
patch instead replaces the errant check with:
  PageTransHuge(page) || PageHuge(page)

Fixes: dd78fedde4b9 ("rmap: support file thp")
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve Capper <steve.capper@arm.com>
---
 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index 709bc83..ad8fc51 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -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 && !(PageTransHuge(page) || PageHuge(page)), page);
 	lock_page_memcg(page);
 
 	/* Hugepages are not counted in NR_FILE_MAPPED for now. */
-- 
1.8.3.1

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-09 16:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 12:34 [PATCH] rmap: Fix compound check logic in page_remove_file_rmap Steve Capper
2016-08-09 16:29 ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).