Re: [PATCH v3 03/28] mm/cma: introduce cma_intersects function
From: Alexander Gordeev
Date: Fri Feb 14 2025 - 05:03:12 EST
On Thu, Feb 06, 2025 at 06:50:43PM +0000, Frank van der Linden wrote:
> Now that CMA areas can have multiple physical ranges,
> code can't assume a CMA struct represents a base_pfn
> plus a size, as returned from cma_get_base.
>
> Most cases are ok though, since they all explicitly
> refer to CMA areas that were created using existing
> interfaces (cma_declare_contiguous_nid or
> cma_init_reserved_mem), which guarantees they have just
> one physical range.
>
> An exception is the s390 code, which walks all CMA
> ranges to see if they intersect with a range of memory
> that is about to be hotremoved. So, in the future,
> it might run in to multi-range areas. To keep this check
> working, define a cma_intersects function. This just checks
> if a physaddr range intersects any of the ranges.
> Use it in the s390 check.
>
> Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
> Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx>
> Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
> Cc: linux-s390@xxxxxxxxxxxxxxx
> Signed-off-by: Frank van der Linden <fvdl@xxxxxxxxxx>
> ---
> arch/s390/mm/init.c | 13 +++++--------
> include/linux/cma.h | 1 +
> mm/cma.c | 21 +++++++++++++++++++++
> 3 files changed, 27 insertions(+), 8 deletions(-)
Acked-by: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>