All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Jerome Marchand <jmarchan@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
Date: Wed, 3 Feb 2016 00:50:58 +0200	[thread overview]
Message-ID: <20160202225058.GA8309@node.shutemov.name> (raw)
In-Reply-To: <1454452420-25007-1-git-send-email-mike.kravetz@oracle.com>

On Tue, Feb 02, 2016 at 02:33:40PM -0800, Mike Kravetz wrote:
> Attempting to preallocate 1G gigantic huge pages at boot time with
> "hugepagesz=1G hugepages=1" on the kernel command line will prevent
> booting with the following:
> 
> kernel BUG at mm/hugetlb.c:1218!
> 
> When mapcount accounting was reworked, the setting of compound_mapcount_ptr
> in prep_compound_gigantic_page was overlooked.  As a result, the validation
> of mapcount in free_huge_page fails.

Oops. Soory for that.

> 
> The "BUG_ON" checks in free_huge_page were also changed to "VM_BUG_ON_PAGE"
> to assist with debugging.
> 
> Fixes: af5642a8af ("mm: rework mapcount accounting to enable 4k mapping of THPs")
> Suggested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

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

> ---
>  mm/hugetlb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 12908dc..d7a8024 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1214,8 +1214,8 @@ void free_huge_page(struct page *page)
>  
>  	set_page_private(page, 0);
>  	page->mapping = NULL;
> -	BUG_ON(page_count(page));
> -	BUG_ON(page_mapcount(page));
> +	VM_BUG_ON_PAGE(page_count(page), page);
> +	VM_BUG_ON_PAGE(page_mapcount(page), page);
>  	restore_reserve = PagePrivate(page);
>  	ClearPagePrivate(page);
>  
> @@ -1286,6 +1286,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)
>  		set_page_count(p, 0);
>  		set_compound_head(p, page);
>  	}
> +	atomic_set(compound_mapcount_ptr(page), -1);
>  }
>  
>  /*
> -- 
> 2.4.3
> 
> --
> 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: Mike Kravetz <mike.kravetz@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Jerome Marchand <jmarchan@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@suse.cz>
Subject: Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
Date: Wed, 3 Feb 2016 00:50:58 +0200	[thread overview]
Message-ID: <20160202225058.GA8309@node.shutemov.name> (raw)
In-Reply-To: <1454452420-25007-1-git-send-email-mike.kravetz@oracle.com>

On Tue, Feb 02, 2016 at 02:33:40PM -0800, Mike Kravetz wrote:
> Attempting to preallocate 1G gigantic huge pages at boot time with
> "hugepagesz=1G hugepages=1" on the kernel command line will prevent
> booting with the following:
> 
> kernel BUG at mm/hugetlb.c:1218!
> 
> When mapcount accounting was reworked, the setting of compound_mapcount_ptr
> in prep_compound_gigantic_page was overlooked.  As a result, the validation
> of mapcount in free_huge_page fails.

Oops. Soory for that.

> 
> The "BUG_ON" checks in free_huge_page were also changed to "VM_BUG_ON_PAGE"
> to assist with debugging.
> 
> Fixes: af5642a8af ("mm: rework mapcount accounting to enable 4k mapping of THPs")
> Suggested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

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

> ---
>  mm/hugetlb.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 12908dc..d7a8024 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1214,8 +1214,8 @@ void free_huge_page(struct page *page)
>  
>  	set_page_private(page, 0);
>  	page->mapping = NULL;
> -	BUG_ON(page_count(page));
> -	BUG_ON(page_mapcount(page));
> +	VM_BUG_ON_PAGE(page_count(page), page);
> +	VM_BUG_ON_PAGE(page_mapcount(page), page);
>  	restore_reserve = PagePrivate(page);
>  	ClearPagePrivate(page);
>  
> @@ -1286,6 +1286,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)
>  		set_page_count(p, 0);
>  		set_compound_head(p, page);
>  	}
> +	atomic_set(compound_mapcount_ptr(page), -1);
>  }
>  
>  /*
> -- 
> 2.4.3
> 
> --
> 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-02-02 22:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 22:33 [PATCH] mm/hugetlb: fix gigantic page initialization/allocation Mike Kravetz
2016-02-02 22:33 ` Mike Kravetz
2016-02-02 22:50 ` Kirill A. Shutemov [this message]
2016-02-02 22:50   ` Kirill A. Shutemov
2016-02-02 22:59 ` David Rientjes
2016-02-02 22:59   ` David Rientjes
2016-02-02 23:17   ` Mike Kravetz
2016-02-02 23:17     ` Mike Kravetz
2016-02-03  3:01     ` Naoya Horiguchi
2016-02-03  3:01       ` Naoya Horiguchi
2016-02-03  4:15       ` Mike Kravetz
2016-02-03  4:15         ` Mike Kravetz
2016-02-05 11:52         ` Vlastimil Babka
2016-02-05 11:52           ` Vlastimil Babka

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=20160202225058.GA8309@node.shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=jmarchan@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=mike.kravetz@oracle.com \
    --cc=n-horiguchi@ah.jp.nec.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.