* [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
@ 2016-02-02 22:33 Mike Kravetz
2016-02-02 22:50 ` Kirill A. Shutemov
2016-02-02 22:59 ` David Rientjes
0 siblings, 2 replies; 7+ messages in thread
From: Mike Kravetz @ 2016-02-02 22:33 UTC (permalink / raw)
To: linux-kernel, linux-mm
Cc: Kirill A. Shutemov, Aneesh Kumar K.V, Jerome Marchand,
Naoya Horiguchi, Andrew Morton, Michal Hocko, Mike Kravetz
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.
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>
---
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>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-02 22:33 [PATCH] mm/hugetlb: fix gigantic page initialization/allocation Mike Kravetz
@ 2016-02-02 22:50 ` Kirill A. Shutemov
2016-02-02 22:59 ` David Rientjes
1 sibling, 0 replies; 7+ messages in thread
From: Kirill A. Shutemov @ 2016-02-02 22:50 UTC (permalink / raw)
To: Mike Kravetz
Cc: linux-kernel, linux-mm, Kirill A. Shutemov, Aneesh Kumar K.V,
Jerome Marchand, Naoya Horiguchi, Andrew Morton, Michal Hocko
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-02 22:33 [PATCH] mm/hugetlb: fix gigantic page initialization/allocation Mike Kravetz
2016-02-02 22:50 ` Kirill A. Shutemov
@ 2016-02-02 22:59 ` David Rientjes
2016-02-02 23:17 ` Mike Kravetz
1 sibling, 1 reply; 7+ messages in thread
From: David Rientjes @ 2016-02-02 22:59 UTC (permalink / raw)
To: Mike Kravetz
Cc: linux-kernel, linux-mm, Kirill A. Shutemov, Aneesh Kumar K.V,
Jerome Marchand, Naoya Horiguchi, Andrew Morton, Michal Hocko
On Tue, 2 Feb 2016, 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.
>
> 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>
I'm not sure whether this should have a "From: Naoya Horiguchi" line with
an accompanying sign-off or not, since Naoya debugged and wrote the actual
fix to prep_compound_gigantic_page().
Acked-by: David Rientjes <rientjes@google.com>
--
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] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-02 22:59 ` David Rientjes
@ 2016-02-02 23:17 ` Mike Kravetz
2016-02-03 3:01 ` Naoya Horiguchi
0 siblings, 1 reply; 7+ messages in thread
From: Mike Kravetz @ 2016-02-02 23:17 UTC (permalink / raw)
To: David Rientjes
Cc: linux-kernel, linux-mm, Kirill A. Shutemov, Aneesh Kumar K.V,
Jerome Marchand, Naoya Horiguchi, Andrew Morton, Michal Hocko
On 02/02/2016 02:59 PM, David Rientjes wrote:
> On Tue, 2 Feb 2016, 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.
>>
>> 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>
>
> I'm not sure whether this should have a "From: Naoya Horiguchi" line with
> an accompanying sign-off or not, since Naoya debugged and wrote the actual
> fix to prep_compound_gigantic_page().
I agree. Naoya did debug and provide fix via e-mail exchange. He did not
sign-off and I could not tell if he was going to pursue. My only intention
was to fix ASAP.
More than happy to give Naoya credit.
--
Mike Kravetz
>
> Acked-by: David Rientjes <rientjes@google.com>
>
--
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] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-02 23:17 ` Mike Kravetz
@ 2016-02-03 3:01 ` Naoya Horiguchi
2016-02-03 4:15 ` Mike Kravetz
0 siblings, 1 reply; 7+ messages in thread
From: Naoya Horiguchi @ 2016-02-03 3:01 UTC (permalink / raw)
To: Mike Kravetz
Cc: David Rientjes, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Kirill A. Shutemov, Aneesh Kumar K.V, Jerome Marchand,
Andrew Morton, Michal Hocko
On Tue, Feb 02, 2016 at 03:17:10PM -0800, Mike Kravetz wrote:
> On 02/02/2016 02:59 PM, David Rientjes wrote:
> > On Tue, 2 Feb 2016, 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.
> >>
> >> 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>
> >
> > I'm not sure whether this should have a "From: Naoya Horiguchi" line with
> > an accompanying sign-off or not, since Naoya debugged and wrote the actual
> > fix to prep_compound_gigantic_page().
>
> I agree. Naoya did debug and provide fix via e-mail exchange. He did not
> sign-off and I could not tell if he was going to pursue. My only intention
> was to fix ASAP.
>
> More than happy to give Naoya credit.
Thank you! It's great if you append my signed-off below yours.
Naoya
--
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] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-03 3:01 ` Naoya Horiguchi
@ 2016-02-03 4:15 ` Mike Kravetz
2016-02-05 11:52 ` Vlastimil Babka
0 siblings, 1 reply; 7+ messages in thread
From: Mike Kravetz @ 2016-02-03 4:15 UTC (permalink / raw)
To: Naoya Horiguchi, Andrew Morton
Cc: David Rientjes, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Kirill A. Shutemov, Aneesh Kumar K.V, Jerome Marchand,
Michal Hocko
On 02/02/2016 07:01 PM, Naoya Horiguchi wrote:
> On Tue, Feb 02, 2016 at 03:17:10PM -0800, Mike Kravetz wrote:
>> I agree. Naoya did debug and provide fix via e-mail exchange. He did not
>> sign-off and I could not tell if he was going to pursue. My only intention
>> was to fix ASAP.
>>
>> More than happy to give Naoya credit.
>
> Thank you! It's great if you append my signed-off below yours.
>
> Naoya
Adding Naoya's sign off and Acks received
mm/hugetlb: fix gigantic page initialization/allocation
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.
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")
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: David Rientjes <rientjes@google.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>
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: fix gigantic page initialization/allocation
2016-02-03 4:15 ` Mike Kravetz
@ 2016-02-05 11:52 ` Vlastimil Babka
0 siblings, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2016-02-05 11:52 UTC (permalink / raw)
To: Mike Kravetz, Naoya Horiguchi, Andrew Morton
Cc: David Rientjes, linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Kirill A. Shutemov, Aneesh Kumar K.V, Jerome Marchand,
Michal Hocko
On 02/03/2016 05:15 AM, Mike Kravetz wrote:
> On 02/02/2016 07:01 PM, Naoya Horiguchi wrote:
>> On Tue, Feb 02, 2016 at 03:17:10PM -0800, Mike Kravetz wrote:
>>> I agree. Naoya did debug and provide fix via e-mail exchange. He did not
>>> sign-off and I could not tell if he was going to pursue. My only intention
>>> was to fix ASAP.
>>>
>>> More than happy to give Naoya credit.
>>
>> Thank you! It's great if you append my signed-off below yours.
>>
>> Naoya
>
> Adding Naoya's sign off and Acks received
>
> mm/hugetlb: fix gigantic page initialization/allocation
>
> 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.
>
> 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")
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Acked-by: David Rientjes <rientjes@google.com>
Tested-by: Vlastimil Babka <vbabka@suse.cz>
--
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] 7+ messages in thread
end of thread, other threads:[~2016-02-05 11:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02 22:33 [PATCH] mm/hugetlb: fix gigantic page initialization/allocation Mike Kravetz
2016-02-02 22:50 ` Kirill A. Shutemov
2016-02-02 22:59 ` David Rientjes
2016-02-02 23:17 ` Mike Kravetz
2016-02-03 3:01 ` Naoya Horiguchi
2016-02-03 4:15 ` Mike Kravetz
2016-02-05 11:52 ` Vlastimil Babka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).