[PATCH 2/4] mm/sparse: skip no-map memblock check when fill_subsection_map

David Hildenbrand david at redhat.com
Mon Jul 11 07:53:36 PDT 2022


On 11.07.22 14:24, Li Chen wrote:
> From: Li Chen <lchen at ambarella.com>
> 
> When mhp use sparse_add_section, don't check no-map region,
> so that to allow no-map reserved memory to get struct page
> support.
> 
> Signed-off-by: Li Chen <lchen at ambarella.com>
> Change-Id: I0d2673cec1b66adf695251037a00c240976b226f
> ---
>  mm/sparse.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/sparse.c b/mm/sparse.c
> index 120bc8ea5293..a29cd1e7014f 100644
> --- a/mm/sparse.c
> +++ b/mm/sparse.c
> @@ -690,7 +690,9 @@ static int fill_subsection_map(unsigned long pfn, unsigned long nr_pages)
>  
>  	if (bitmap_empty(map, SUBSECTIONS_PER_SECTION))
>  		rc = -EINVAL;
> -	else if (bitmap_intersects(map, subsection_map, SUBSECTIONS_PER_SECTION))
> +	else if (memblock_is_map_memory(PFN_PHYS(pfn)) &&
> +		 bitmap_intersects(map, subsection_map,
> +				   SUBSECTIONS_PER_SECTION))
>  		rc = -EEXIST;
>  	else
>  		bitmap_or(subsection_map, map, subsection_map,

I'm not sure I follow completely what you are trying to achieve. But if
you have to add memblock hacks into mm/sparse.c you're most probably
doing something wrong.

Please explain why that change is necessary, and why it is safe.

If the subsection map already spans memory (iow, subsection map is set)
you intend to add, then something already added memory in that range?

-- 
Thanks,

David / dhildenb




More information about the linux-arm-kernel mailing list