aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Norov (NVIDIA) <[email protected]>2025-07-19 20:54:00 +0000
committerAndrew Morton <[email protected]>2025-07-25 02:12:36 +0000
commitc79147e4b02fa3679aebf34121b12f5097731d8a (patch)
treedc4512713ac1863ef9a7ca9979967441a2537b6e
parentmm: cma: simplify cma_debug_show_areas() (diff)
downloadkernel-c79147e4b02fa3679aebf34121b12f5097731d8a.tar.gz
kernel-c79147e4b02fa3679aebf34121b12f5097731d8a.zip
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/[email protected] Signed-off-by: Yury Norov (NVIDIA) <[email protected]> Acked-by: David Hildenbrand <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/cma_debug.c10
1 files changed, 1 insertions, 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;