Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1459688 > unrolled thread

[PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap

Started bySteve Capper <steve.capper@arm.com>
First post2016-08-10 21:40 +0200
Last post2016-08-10 21:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap Steve Capper <steve.capper@arm.com> - 2016-08-10 21:40 +0200
    Re: [PATCH v2] rmap: Fix compound check logic in  page_remove_file_rmap "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-08-10 21:50 +0200

#1459688 — [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap

FromSteve Capper <steve.capper@arm.com>
Date2016-08-10 21:40 +0200
Subject[PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
Message-ID<s4Hw7-YV-31@gated-at.bofh.it>
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 <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve Capper <steve.capper@arm.com>

---

v2 - switch to PageHead as suggested by Kirill.
---
 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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

[toc] | [next] | [standalone]


#1459714 — Re: [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2016-08-10 21:50 +0200
SubjectRe: [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
Message-ID<s4HFM-12V-43@gated-at.bofh.it>
In reply to#1459688
On Wed, Aug 10, 2016 at 03:10:17PM +0100, Steve Capper wrote:
> 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 <kirill.shutemov@linux.intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Steve Capper <steve.capper@arm.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web