All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Steve Capper <steve.capper@arm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	shijie.huang@arm.com, will.deacon@arm.com,
	catalin.marinas@arm.com
Subject: Re: [PATCH] rmap: Fix compound check logic in page_remove_file_rmap
Date: Tue, 9 Aug 2016 19:29:15 +0300	[thread overview]
Message-ID: <20160809162915.GA10293@node.shutemov.name> (raw)
In-Reply-To: <1470746075-20856-1-git-send-email-steve.capper@arm.com>

On Tue, Aug 09, 2016 at 01:34:35PM +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.
> 
> 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)

I think PageHead() check should be enough to cover this.

> 
> 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>

-- 
 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>

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Steve Capper <steve.capper@arm.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	shijie.huang@arm.com, will.deacon@arm.com,
	catalin.marinas@arm.com
Subject: Re: [PATCH] rmap: Fix compound check logic in page_remove_file_rmap
Date: Tue, 9 Aug 2016 19:29:15 +0300	[thread overview]
Message-ID: <20160809162915.GA10293@node.shutemov.name> (raw)
In-Reply-To: <1470746075-20856-1-git-send-email-steve.capper@arm.com>

On Tue, Aug 09, 2016 at 01:34:35PM +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.
> 
> 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)

I think PageHead() check should be enough to cover this.

> 
> 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>

-- 
 Kirill A. Shutemov

  reply	other threads:[~2016-08-09 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 12:34 [PATCH] rmap: Fix compound check logic in page_remove_file_rmap Steve Capper
2016-08-09 12:34 ` Steve Capper
2016-08-09 16:29 ` Kirill A. Shutemov [this message]
2016-08-09 16:29   ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160809162915.GA10293@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shijie.huang@arm.com \
    --cc=steve.capper@arm.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.