Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: cma: simplify cma_maxchunk_get()

The function opencodes for_each_clear_bitrange(). Fix that and drop most
of housekeeping code.

Link: https://lkml.kernel.org/r/20250719205401.399475-3-yury.norov@gmail.com
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Yury Norov (NVIDIA) and committed by
Andrew Morton
c79147e4 77c50f91

+1 -9
+1 -9
mm/cma_debug.c
··· 56 56 for (r = 0; r < cma->nranges; r++) { 57 57 cmr = &cma->ranges[r]; 58 58 bitmap_maxno = cma_bitmap_maxno(cma, cmr); 59 - end = 0; 60 - for (;;) { 61 - start = find_next_zero_bit(cmr->bitmap, 62 - bitmap_maxno, end); 63 - if (start >= bitmap_maxno) 64 - break; 65 - end = find_next_bit(cmr->bitmap, bitmap_maxno, 66 - start); 59 + for_each_clear_bitrange(start, end, cmr->bitmap, bitmap_maxno) 67 60 maxchunk = max(end - start, maxchunk); 68 - } 69 61 } 70 62 spin_unlock_irq(&cma->lock); 71 63 *val = (u64)maxchunk << cma->order_per_bit;