linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Yury Norov <yury.norov@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: cma: simplify cma_maxchunk_get()
Date: Mon, 21 Jul 2025 12:59:53 +0200	[thread overview]
Message-ID: <2cae64a2-7fd4-46ae-b4ab-8924db99154b@redhat.com> (raw)
In-Reply-To: <20250719205401.399475-3-yury.norov@gmail.com>

On 19.07.25 22:54, Yury Norov wrote:
> From: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> 
> The function opencodes for_each_clear_bitrange(). Fix that and drop most
> of housekeeping code.

Not sure if talking about a "fix" it the right word here.

Acked-by: David Hildenbrand <david@redhat.com>

> 
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> ---
>   mm/cma_debug.c | 10 +---------
>   1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/mm/cma_debug.c b/mm/cma_debug.c
> index fdf899532ca0..8c7d7f8e8fbd 100644
> --- a/mm/cma_debug.c
> +++ b/mm/cma_debug.c
> @@ -56,16 +56,8 @@ static int cma_maxchunk_get(void *data, u64 *val)
>   	for (r = 0; r < cma->nranges; r++) {
>   		cmr = &cma->ranges[r];
>   		bitmap_maxno = cma_bitmap_maxno(cma, cmr);
> -		end = 0;
> -		for (;;) {
> -			start = find_next_zero_bit(cmr->bitmap,
> -						   bitmap_maxno, end);
> -			if (start >= bitmap_maxno)
> -				break;
> -			end = find_next_bit(cmr->bitmap, bitmap_maxno,
> -					    start);
> +		for_each_clear_bitrange(start, end, cmr->bitmap, bitmap_maxno)
>   			maxchunk = max(end - start, maxchunk);
> -		}
>   	}
>   	spin_unlock_irq(&cma->lock);
>   	*val = (u64)maxchunk << cma->order_per_bit;


-- 
Cheers,

David / dhildenb



      reply	other threads:[~2025-07-21 11:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-19 20:53 [PATCH 0/2] mm/cma: ise for_each_clear_bitrange() where appropriate Yury Norov
2025-07-19 20:53 ` [PATCH 1/2] mm: cma: simplify cma_debug_show_areas() Yury Norov
2025-07-21 11:01   ` David Hildenbrand
2025-07-19 20:54 ` [PATCH 2/2] mm: cma: simplify cma_maxchunk_get() Yury Norov
2025-07-21 10:59   ` David Hildenbrand [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=2cae64a2-7fd4-46ae-b4ab-8924db99154b@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yury.norov@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox