All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>
Cc: "Frank van der Linden" <fvdl@google.com>,
	"Ivy Lopez" <skunkolee@gmail.com>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] mm/cma: simplify cma_declare_contiguous_multi()
Date: Wed, 11 Nov 2026 22:15:02 +0000	[thread overview]
Message-ID: <sashiko-outbox-209775@kernel.org> (raw)
In-Reply-To: <20261111-cma-multi-v2-1-4e2dddb2a2d8@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm/cma: unguarded 64-bit SZ_4G comparison in
  cma_find_free_range() on 32-bit
--

commit c3ad286c7568d10ee09caebdcdc606cff727c93b
Author: Mike Rapoport (Microsoft) <rppt@kernel.org>

mm/cma: simplify cma_declare_contiguous_multi()

This commit replaces the linked-list range collection in
cma_declare_contiguous_multi() with a loop that repeatedly reserves the
largest free memblock range above 4G and then sorts the resulting ranges.

> diff --git a/mm/cma.c b/mm/cma.c
> index f61d52796f4ef..f01850d13799f 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c

[ ... ]

> @@ -524,37 +474,71 @@ static int __init __cma_declare_contiguous_nid(phys_addr_t *basep,
>  	return 0;
>  }
>  
> +/*
> + * Find the largest free range above 4G that can hold a part of a multi-range
> + * CMA area.
> + */
> +static phys_addr_t __init cma_find_free_range(phys_addr_t align,
> +		phys_addr_t size_align, int nid, phys_addr_t *basep)
> +{
> +	phys_addr_t start, end, size;
> +	phys_addr_t max = 0;
> +	u64 i;
> +
> +	for_each_free_mem_range(i, nid, MEMBLOCK_NONE, &start, &end, NULL) {
> +		if (start < SZ_4G)
> +			continue;

[Severity: Low]
Does comparing start against SZ_4G trigger a
-Wtautological-constant-out-of-range-compare warning on 32-bit Clang W=1
builds when CONFIG_PHYS_ADDR_T_64BIT is disabled?

When CONFIG_PHYS_ADDR_T_64BIT is not set, phys_addr_t is u32 while SZ_4G
is 0x100000000ULL.  The previous code checked upper_32_bits(start) == 0,
and cma_alloc_mem() in the same file guards its SZ_4G check with #ifdef
CONFIG_PHYS_ADDR_T_64BIT.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-cma-multi-v2-1-4e2dddb2a2d8@kernel.org?part=1


      parent reply	other threads:[~2026-11-11 22:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 22:14 [PATCH v2] mm/cma: simplify cma_declare_contiguous_multi() Mike Rapoport (Microsoft)
2026-11-11  1:09 ` Liam R. Howlett
2026-11-11  8:03 ` David Hildenbrand (Arm)
2026-11-11  8:26 ` Oscar Salvador (SUSE)
2026-11-11 22:15 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-209775@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=fvdl@google.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=skunkolee@gmail.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.