All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
@ 2016-08-10 14:10 ` Steve Capper
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Capper @ 2016-08-10 14:10 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, shijie.huang, will.deacon, catalin.marinas,
	Steve Capper, Kirill A . Shutemov, Andrew Morton

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

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

* [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
@ 2016-08-10 14:10 ` Steve Capper
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Capper @ 2016-08-10 14:10 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-kernel, shijie.huang, will.deacon, catalin.marinas,
	Steve Capper, Kirill A . Shutemov, Andrew Morton

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

--
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] 4+ messages in thread

* Re: [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
  2016-08-10 14:10 ` Steve Capper
@ 2016-08-10 16:14   ` Kirill A. Shutemov
  -1 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-08-10 16:14 UTC (permalink / raw)
  To: Steve Capper
  Cc: linux-mm, linux-kernel, shijie.huang, will.deacon,
	catalin.marinas, Andrew Morton

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

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

* Re: [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap
@ 2016-08-10 16:14   ` Kirill A. Shutemov
  0 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-08-10 16:14 UTC (permalink / raw)
  To: Steve Capper
  Cc: linux-mm, linux-kernel, shijie.huang, will.deacon,
	catalin.marinas, Andrew Morton

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

--
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	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-10 19:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 14:10 [PATCH v2] rmap: Fix compound check logic in page_remove_file_rmap Steve Capper
2016-08-10 14:10 ` Steve Capper
2016-08-10 16:14 ` Kirill A. Shutemov
2016-08-10 16:14   ` Kirill A. Shutemov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.