@@ -403,6 +403,17 @@ static void cma_debug_show_areas(struct
spin_unlock_irq(&cma->lock);
}
+static unsigned long cma_get_used(struct cma *cma)
+{
+ unsigned long used;
+
+ spin_lock_irq(&cma->lock);
+ used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma));
+ spin_unlock_irq(&cma->lock);
+
+ return used << cma->order_per_bit;
+}
+
static struct page *__cma_alloc(struct cma *cma, unsigned long count,
unsigned int align, gfp_t gfp)
{
@@ -420,8 +431,8 @@ static struct page *__cma_alloc(struct c
if (!cma || !cma->count || !cma->bitmap)
return page;
- pr_debug("%s(cma %p, name: %s, count %lu, align %d)\n", __func__,
- (void *)cma, cma->name, count, align);
+ pr_debug("%s(cma %p, name: %s, total count %lu, used count: %lu, request count %lu, align %d)\n", __func__,
+ (void *)cma, cma->name, cma->count, cma_get_used(cma), count, align);
if (!count)
return page;