2021-03-25 11:44:58

by Wang Wensheng

[permalink] [raw]
Subject: [PATCH] mm/sparse: Add the missing sparse_buffer_fini() in error branch

sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or
a WARN issue would be through the next time sparse_buffer_init() runs.

Add the missing sparse_buffer_fini() in error branch.

Fixes: 85c77f791390 ("mm/sparse: add new sparse_init_nid() and sparse_init()")
Signed-off-by: Wang Wensheng <[email protected]>
---
mm/sparse.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/sparse.c b/mm/sparse.c
index 7bd23f9..33406ea 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -547,6 +547,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,
pr_err("%s: node[%d] memory map backing failed. Some memory will not be available.",
__func__, nid);
pnum_begin = pnum;
+ sparse_buffer_fini();
goto failed;
}
check_usemap_section_nr(nid, usage);
--
2.9.4


2021-03-25 12:47:15

by David Hildenbrand

[permalink] [raw]
Subject: Re: [PATCH] mm/sparse: Add the missing sparse_buffer_fini() in error branch

On 25.03.21 12:31, Wang Wensheng wrote:
> sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or
> a WARN issue would be through the next time sparse_buffer_init() runs.
>
> Add the missing sparse_buffer_fini() in error branch.
>
> Fixes: 85c77f791390 ("mm/sparse: add new sparse_init_nid() and sparse_init()")
> Signed-off-by: Wang Wensheng <[email protected]>
> ---
> mm/sparse.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 7bd23f9..33406ea 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -547,6 +547,7 @@ static void __init sparse_init_nid(int nid, unsigned long pnum_begin,
> pr_err("%s: node[%d] memory map backing failed. Some memory will not be available.",
> __func__, nid);
> pnum_begin = pnum;
> + sparse_buffer_fini();
> goto failed;
> }
> check_usemap_section_nr(nid, usage);
>

Did you actually manage to reproduce this? I would have thought that
__populate_section_memmap() barely fails during boot ...


Anyhow, looks like the right think to do to me

Reviewed-by: David Hildenbrand <[email protected]>

--
Thanks,

David / dhildenb

2021-03-25 13:23:04

by Oscar Salvador

[permalink] [raw]
Subject: Re: [PATCH] mm/sparse: Add the missing sparse_buffer_fini() in error branch

On Thu, Mar 25, 2021 at 11:31:55AM +0000, Wang Wensheng wrote:
> sparse_buffer_init() and sparse_buffer_fini() should appear in pair, or
> a WARN issue would be through the next time sparse_buffer_init() runs.
>
> Add the missing sparse_buffer_fini() in error branch.
>
> Fixes: 85c77f791390 ("mm/sparse: add new sparse_init_nid() and sparse_init()")
> Signed-off-by: Wang Wensheng <[email protected]>

Reviewed-by: Oscar Salvador <[email protected]>


--
Oscar Salvador
SUSE L3