summaryrefslogtreecommitdiffstats
path: root/mm/cma_debug.c
diff options
context:
space:
mode:
authorJoonsoo Kim <js1304@gmail.com>2015-07-18 01:24:23 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-18 01:39:54 +0200
commitd56e84b4064d65285161d6bfa04382e1cdd4e49c (patch)
treeed35ca7cffee972c75be915ca25298dfeea0c78c /mm/cma_debug.c
parentmm/cma_debug: fix debugging alloc/free interface (diff)
downloadlinux-d56e84b4064d65285161d6bfa04382e1cdd4e49c.tar.xz
linux-d56e84b4064d65285161d6bfa04382e1cdd4e49c.zip
mm/cma_debug: correct size input to bitmap function
In CMA, 1 bit in bitmap means 1 << order_per_bits pages so size of bitmap is cma->count >> order_per_bits rather than just cma->count. This patch fixes it. Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Stefan Strogin <stefan.strogin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/cma_debug.c')
-rw-r--r--mm/cma_debug.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 22190a7fd58e..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)
mutex_lock(&cma->lock);
/* 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);
*val = (u64)used << cma->order_per_bit;
@@ -52,13 +52,14 @@ static int cma_maxchunk_get(void *data, u64 *val)
struct cma *cma = data;
unsigned long maxchunk = 0;
unsigned long start, end = 0;
+ unsigned long bitmap_maxno = cma_bitmap_maxno(cma);
mutex_lock(&cma->lock);
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)
break;
- end = find_next_bit(cma->bitmap, cma->count, start);
+ end = find_next_bit(cma->bitmap, bitmap_maxno, start);
maxchunk = max(end - start, maxchunk);
}
mutex_unlock(&cma->lock);