|
@@ -39,7 +39,7 @@ static int cma_used_get(void *data, u64 *val)
|
|
|
|
|
|
mutex_lock(&cma->lock);
|
|
mutex_lock(&cma->lock);
|
|
/* pages counter is smaller than sizeof(int) */
|
|
/* pages counter is smaller than sizeof(int) */
|
|
- used = bitmap_weight(cma->bitmap, (int)cma->count);
|
|
|
|
|
|
+ used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma));
|
|
mutex_unlock(&cma->lock);
|
|
mutex_unlock(&cma->lock);
|
|
*val = (u64)used << cma->order_per_bit;
|
|
*val = (u64)used << cma->order_per_bit;
|
|
|
|
|
|
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val)
|
|
struct cma *cma = data;
|
|
struct cma *cma = data;
|
|
unsigned long maxchunk = 0;
|
|
unsigned long maxchunk = 0;
|
|
unsigned long start, end = 0;
|
|
unsigned long start, end = 0;
|
|
|
|
+ unsigned long bitmap_maxno = cma_bitmap_maxno(cma);
|
|
|
|
|
|
mutex_lock(&cma->lock);
|
|
mutex_lock(&cma->lock);
|
|
for (;;) {
|
|
for (;;) {
|
|
- start = find_next_zero_bit(cma->bitmap, cma->count, end);
|
|
|
|
|
|
+ start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end);
|
|
if (start >= cma->count)
|
|
if (start >= cma->count)
|
|
break;
|
|
break;
|
|
- end = find_next_bit(cma->bitmap, cma->count, start);
|
|
|
|
|
|
+ end = find_next_bit(cma->bitmap, bitmap_maxno, start);
|
|
maxchunk = max(end - start, maxchunk);
|
|
maxchunk = max(end - start, maxchunk);
|
|
}
|
|
}
|
|
mutex_unlock(&cma->lock);
|
|
mutex_unlock(&cma->lock);
|