From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796AbcHIMer (ORCPT ); Tue, 9 Aug 2016 08:34:47 -0400 Received: from foss.arm.com ([217.140.101.70]:41881 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752729AbcHIMeq (ORCPT ); Tue, 9 Aug 2016 08:34:46 -0400 From: Steve Capper To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, shijie.huang@arm.com, will.deacon@arm.com, catalin.marinas@arm.com Subject: [PATCH] rmap: Fix compound check logic in page_remove_file_rmap Date: Tue, 9 Aug 2016 13:34:35 +0100 Message-Id: <1470746075-20856-1-git-send-email-steve.capper@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Andrew Morton Signed-off-by: Steve Capper --- 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