diff options
Diffstat (limited to 'mm/cma_debug.c')
-rw-r--r-- | mm/cma_debug.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/mm/cma_debug.c b/mm/cma_debug.c index 7621ee34daa0..f8e4b60db167 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c | |||
@@ -39,7 +39,7 @@ static int cma_used_get(void *data, u64 *val) | |||
39 | 39 | ||
40 | mutex_lock(&cma->lock); | 40 | mutex_lock(&cma->lock); |
41 | /* pages counter is smaller than sizeof(int) */ | 41 | /* pages counter is smaller than sizeof(int) */ |
42 | used = bitmap_weight(cma->bitmap, (int)cma->count); | 42 | used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma)); |
43 | mutex_unlock(&cma->lock); | 43 | mutex_unlock(&cma->lock); |
44 | *val = (u64)used << cma->order_per_bit; | 44 | *val = (u64)used << cma->order_per_bit; |
45 | 45 | ||
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val) | |||
52 | struct cma *cma = data; | 52 | struct cma *cma = data; |
53 | unsigned long maxchunk = 0; | 53 | unsigned long maxchunk = 0; |
54 | unsigned long start, end = 0; | 54 | unsigned long start, end = 0; |
55 | unsigned long bitmap_maxno = cma_bitmap_maxno(cma); | ||
55 | 56 | ||
56 | mutex_lock(&cma->lock); | 57 | mutex_lock(&cma->lock); |
57 | for (;;) { | 58 | for (;;) { |
58 | start = find_next_zero_bit(cma->bitmap, cma->count, end); | 59 | start = find_next_zero_bit(cma->bitmap, bitmap_maxno, end); |
59 | if (start >= cma->count) | 60 | if (start >= cma->count) |
60 | break; | 61 | break; |
61 | end = find_next_bit(cma->bitmap, cma->count, start); | 62 | end = find_next_bit(cma->bitmap, bitmap_maxno, start); |
62 | maxchunk = max(end - start, maxchunk); | 63 | maxchunk = max(end - start, maxchunk); |
63 | } | 64 | } |
64 | mutex_unlock(&cma->lock); | 65 | mutex_unlock(&cma->lock); |
@@ -170,10 +171,10 @@ static void cma_debugfs_add_one(struct cma *cma, int idx) | |||
170 | 171 | ||
171 | tmp = debugfs_create_dir(name, cma_debugfs_root); | 172 | tmp = debugfs_create_dir(name, cma_debugfs_root); |
172 | 173 | ||
173 | debugfs_create_file("alloc", S_IWUSR, cma_debugfs_root, cma, | 174 | debugfs_create_file("alloc", S_IWUSR, tmp, cma, |
174 | &cma_alloc_fops); | 175 | &cma_alloc_fops); |
175 | 176 | ||
176 | debugfs_create_file("free", S_IWUSR, cma_debugfs_root, cma, | 177 | debugfs_create_file("free", S_IWUSR, tmp, cma, |
177 | &cma_free_fops); | 178 | &cma_free_fops); |
178 | 179 | ||
179 | debugfs_create_file("base_pfn", S_IRUGO, tmp, | 180 | debugfs_create_file("base_pfn", S_IRUGO, tmp, |