[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <xa1t1tg9fx0r.fsf@mina86.com>
Date: Wed, 15 Jul 2015 14:03:32 +0200
From: Michal Nazarewicz <mina86@...a86.com>
To: Joonsoo Kim <js1304@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Sasha Levin <sasha.levin@...cle.com>,
Stefan Strogin <stefan.strogin@...il.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCH 2/2] mm/cma_debug: correct size input to bitmap function
On Wed, Jul 15 2015, Joonsoo Kim wrote:
> 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@....com>
Acked-by: Michal Nazarewicz <mina86@...a86.com>
> ---
> mm/cma_debug.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/cma_debug.c b/mm/cma_debug.c
> index 22190a7..f8e4b60 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);
> --
> 1.9.1
>
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +--<mpn@...gle.com>--<xmpp:mina86@...ber.org>--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists