diff options
| author | Yury Norov (NVIDIA) <[email protected]> | 2025-07-19 20:53:59 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-07-25 02:12:36 +0000 |
| commit | 77c50f9147eabcf726f62c73167bb9d9e8621a43 (patch) | |
| tree | daca6b4f1dbd1f9f045ac32be4fcd9cc9d8a4a6e | |
| parent | fs: stable_page_flags(): use snapshot_page() (diff) | |
| download | kernel-77c50f9147eabcf726f62c73167bb9d9e8621a43.tar.gz kernel-77c50f9147eabcf726f62c73167bb9d9e8621a43.zip | |
mm: cma: simplify cma_debug_show_areas()
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.c | 19 |
1 files changed, 4 insertions, 15 deletions
@@ -751,8 +751,7 @@ int __init cma_declare_contiguous_nid(phys_addr_t base, static void cma_debug_show_areas(struct cma *cma) { - unsigned long next_zero_bit, next_set_bit, nr_zero; - unsigned long start; + unsigned long start, end; unsigned long nr_part; unsigned long nbits; int r; @@ -763,22 +762,12 @@ static void cma_debug_show_areas(struct cma *cma) for (r = 0; r < cma->nranges; r++) { cmr = &cma->ranges[r]; - start = 0; nbits = cma_bitmap_maxno(cma, cmr); pr_info("range %d: ", r); - for (;;) { - next_zero_bit = find_next_zero_bit(cmr->bitmap, - nbits, start); - if (next_zero_bit >= nbits) - break; - next_set_bit = find_next_bit(cmr->bitmap, nbits, - next_zero_bit); - nr_zero = next_set_bit - next_zero_bit; - nr_part = nr_zero << cma->order_per_bit; - pr_cont("%s%lu@%lu", start ? "+" : "", nr_part, - next_zero_bit); - start = next_zero_bit + nr_zero; + for_each_clear_bitrange(start, end, cmr->bitmap, nbits) { + nr_part = (end - start) << cma->order_per_bit; + pr_cont("%s%lu@%lu", start ? "+" : "", nr_part, start); } pr_info("\n"); } |
