linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@mina86.com>
To: Joonsoo Kim <js1304@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Sasha Levin <sasha.levin@oracle.com>,
	Stefan Strogin <stefan.strogin@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH 2/2] mm/cma_debug: correct size input to bitmap function
Date: Wed, 15 Jul 2015 14:03:32 +0200	[thread overview]
Message-ID: <xa1t1tg9fx0r.fsf@mina86.com> (raw)
In-Reply-To: <1436942129-18020-2-git-send-email-iamjoonsoo.kim@lge.com>

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@lge.com>

Acked-by: Michal Nazarewicz <mina86@mina86.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@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-07-15 12:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15  6:35 [PATCH 1/2] mm/cma_debug: fix debugging alloc/free interface Joonsoo Kim
2015-07-15  6:35 ` [PATCH 2/2] mm/cma_debug: correct size input to bitmap function Joonsoo Kim
2015-07-15 12:03   ` Michal Nazarewicz [this message]
2015-07-15 12:03 ` [PATCH 1/2] mm/cma_debug: fix debugging alloc/free interface Michal Nazarewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xa1t1tg9fx0r.fsf@mina86.com \
    --to=mina86@mina86.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.com \
    --cc=stefan.strogin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox