linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work
@ 2021-11-29 13:38 Zhenguo Yao
  2021-11-29 20:58 ` Mike Kravetz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Zhenguo Yao @ 2021-11-29 13:38 UTC (permalink / raw)
  To: mike.kravetz, akpm, mlevitsk; +Cc: linux-kernel, linux-mm, Zhenguo Yao

Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b
(hugetlbfs: extend the definition of hugepages parameter to support node
allocation). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will
always return without doing allocation. Fix this by adding more check.

Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 60f9b6a9582e..6d1603387914 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)
 	struct huge_bootmem_page *m = NULL; /* initialize for clang */
 	int nr_nodes, node;
 
-	if (nid >= nr_online_nodes)
+	if (nid != NUMA_NO_NODE && nid >= nr_online_nodes)
 		return 0;
 	/* do node specific alloc */
 	if (nid != NUMA_NO_NODE) {
-- 
2.27.0


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

* Re: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work
  2021-11-29 13:38 [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Zhenguo Yao
@ 2021-11-29 20:58 ` Mike Kravetz
  2021-11-30  1:41 ` Baolin Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Kravetz @ 2021-11-29 20:58 UTC (permalink / raw)
  To: Zhenguo Yao, akpm, mlevitsk; +Cc: linux-kernel, linux-mm

On 11/29/21 05:38, Zhenguo Yao wrote:
> Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b
> (hugetlbfs: extend the definition of hugepages parameter to support node
> allocation). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will
> always return without doing allocation. Fix this by adding more check.
> 
> Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>

Thank you,


Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 60f9b6a9582e..6d1603387914 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)
>  	struct huge_bootmem_page *m = NULL; /* initialize for clang */
>  	int nr_nodes, node;
>  
> -	if (nid >= nr_online_nodes)
> +	if (nid != NUMA_NO_NODE && nid >= nr_online_nodes)
>  		return 0;
>  	/* do node specific alloc */
>  	if (nid != NUMA_NO_NODE) {
> 


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

* Re: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work
  2021-11-29 13:38 [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Zhenguo Yao
  2021-11-29 20:58 ` Mike Kravetz
@ 2021-11-30  1:41 ` Baolin Wang
  2021-11-30  2:33 ` Muchun Song
  2021-11-30  7:48 ` Maxim Levitsky
  3 siblings, 0 replies; 5+ messages in thread
From: Baolin Wang @ 2021-11-30  1:41 UTC (permalink / raw)
  To: Zhenguo Yao, mike.kravetz, akpm, mlevitsk; +Cc: linux-kernel, linux-mm

Hi,

On 2021/11/29 21:38, Zhenguo Yao wrote:
> Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b
> (hugetlbfs: extend the definition of hugepages parameter to support node
> allocation). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will
> always return without doing allocation. Fix this by adding more check.
> 
> Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>

You should add a fixes tag, otherwise LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

Fixes: b5389086ad7b ("hugetlbfs: extend the definition of hugepages 
parameter to support node allocation")

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

* Re: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work
  2021-11-29 13:38 [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Zhenguo Yao
  2021-11-29 20:58 ` Mike Kravetz
  2021-11-30  1:41 ` Baolin Wang
@ 2021-11-30  2:33 ` Muchun Song
  2021-11-30  7:48 ` Maxim Levitsky
  3 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2021-11-30  2:33 UTC (permalink / raw)
  To: Zhenguo Yao
  Cc: Mike Kravetz, Andrew Morton, mlevitsk, LKML,
	Linux Memory Management List

On Mon, Nov 29, 2021 at 11:27 PM Zhenguo Yao <yaozhenguo1@gmail.com> wrote:
>
> Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b
> (hugetlbfs: extend the definition of hugepages parameter to support node
> allocation). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will
> always return without doing allocation. Fix this by adding more check.
>
> Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.

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

* Re: [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work
  2021-11-29 13:38 [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Zhenguo Yao
                   ` (2 preceding siblings ...)
  2021-11-30  2:33 ` Muchun Song
@ 2021-11-30  7:48 ` Maxim Levitsky
  3 siblings, 0 replies; 5+ messages in thread
From: Maxim Levitsky @ 2021-11-30  7:48 UTC (permalink / raw)
  To: Zhenguo Yao, mike.kravetz, akpm; +Cc: linux-kernel, linux-mm

On Mon, 2021-11-29 at 21:38 +0800, Zhenguo Yao wrote:
> Preallocation of gigantic pages can't work bacause of commit:b5389086ad7b
> (hugetlbfs: extend the definition of hugepages parameter to support node
> allocation). When nid is NUMA_NO_NODE(-1), alloc_bootmem_huge_page will
> always return without doing allocation. Fix this by adding more check.
> 
> Signed-off-by: Zhenguo Yao <yaozhenguo1@gmail.com>
> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 60f9b6a9582e..6d1603387914 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -2876,7 +2876,7 @@ int __alloc_bootmem_huge_page(struct hstate *h, int nid)
>  	struct huge_bootmem_page *m = NULL; /* initialize for clang */
>  	int nr_nodes, node;
>  
> -	if (nid >= nr_online_nodes)
> +	if (nid != NUMA_NO_NODE && nid >= nr_online_nodes)
>  		return 0;
>  	/* do node specific alloc */
>  	if (nid != NUMA_NO_NODE) {

Tested, works fine.

Thanks!
Tested-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky


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

end of thread, other threads:[~2021-11-30  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 13:38 [BUG] hugetlbfs: Fix issue of preallocation of gigantic pages can't work Zhenguo Yao
2021-11-29 20:58 ` Mike Kravetz
2021-11-30  1:41 ` Baolin Wang
2021-11-30  2:33 ` Muchun Song
2021-11-30  7:48 ` Maxim Levitsky

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