linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [next:master 9613/10050] mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
@ 2015-04-08 14:04 Dan Carpenter
  2015-04-08 19:45 ` [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3 Dmitry Safonov
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-04-08 14:04 UTC (permalink / raw)
  To: kbuild, Stefan Strogin
  Cc: Andrew Morton, Linux Memory Management List, Dan Carpenter

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a897436e0e233e84b664bb7f33c4e0d4d3e3bdad
commit: 8b0c0ea86849b55091281d146d62bbd9cda87556 [9613/10050] mm-cma-add-functions-to-get-region-pages-counters-fix-2

mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
mm/cma_debug.c:67 cma_maxchunk_get() warn: should 'maxchunk << cma->order_per_bit' be a 64 bit type?

git remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 8b0c0ea86849b55091281d146d62bbd9cda87556
vim +45 mm/cma_debug.c

8b0c0ea8 Stefan Strogin 2015-04-08  39  	unsigned long used;
c8e6dfcb Dmitry Safonov 2015-04-08  40  
8b0c0ea8 Stefan Strogin 2015-04-08  41  	mutex_lock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08  42  	/* pages counter is smaller than sizeof(int) */
8b0c0ea8 Stefan Strogin 2015-04-08  43  	used = bitmap_weight(cma->bitmap, (int)cma->count);
8b0c0ea8 Stefan Strogin 2015-04-08  44  	mutex_unlock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08 @45  	*val = used << cma->order_per_bit;
c8e6dfcb Dmitry Safonov 2015-04-08  46  
c8e6dfcb Dmitry Safonov 2015-04-08  47  	return 0;
c8e6dfcb Dmitry Safonov 2015-04-08  48  }
c8e6dfcb Dmitry Safonov 2015-04-08  49  
c8e6dfcb Dmitry Safonov 2015-04-08  50  DEFINE_SIMPLE_ATTRIBUTE(cma_used_fops, cma_used_get, NULL, "%llu\n");
c8e6dfcb Dmitry Safonov 2015-04-08  51  
c8e6dfcb Dmitry Safonov 2015-04-08  52  static int cma_maxchunk_get(void *data, u64 *val)
c8e6dfcb Dmitry Safonov 2015-04-08  53  {
c8e6dfcb Dmitry Safonov 2015-04-08  54  	struct cma *cma = data;
8b0c0ea8 Stefan Strogin 2015-04-08  55  	unsigned long maxchunk = 0;
8b0c0ea8 Stefan Strogin 2015-04-08  56  	unsigned long start, end = 0;
c8e6dfcb Dmitry Safonov 2015-04-08  57  
8b0c0ea8 Stefan Strogin 2015-04-08  58  	mutex_lock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08  59  	for (;;) {
8b0c0ea8 Stefan Strogin 2015-04-08  60  		start = find_next_zero_bit(cma->bitmap, cma->count, end);
8b0c0ea8 Stefan Strogin 2015-04-08  61  		if (start >= cma->count)
8b0c0ea8 Stefan Strogin 2015-04-08  62  			break;
8b0c0ea8 Stefan Strogin 2015-04-08  63  		end = find_next_bit(cma->bitmap, cma->count, start);
8b0c0ea8 Stefan Strogin 2015-04-08  64  		maxchunk = max(end - start, maxchunk);
8b0c0ea8 Stefan Strogin 2015-04-08  65  	}
8b0c0ea8 Stefan Strogin 2015-04-08  66  	mutex_unlock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08 @67  	*val = maxchunk << cma->order_per_bit;
c8e6dfcb Dmitry Safonov 2015-04-08  68  
c8e6dfcb Dmitry Safonov 2015-04-08  69  	return 0;
c8e6dfcb Dmitry Safonov 2015-04-08  70  }

---
0-DAY kernel test infrastructure                Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

--
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3
  2015-04-08 14:04 [next:master 9613/10050] mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type? Dan Carpenter
@ 2015-04-08 19:45 ` Dmitry Safonov
  2015-04-08 20:55   ` Michal Nazarewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Safonov @ 2015-04-08 19:45 UTC (permalink / raw)
  To: dan.carpenter
  Cc: kbuild, stefan.strogin, akpm, linux-mm, Dmitry Safonov,
	Michal Nazarewicz, Marek Szyprowski, Joonsoo Kim, Pintu Kumar,
	Weijie Yang, Laurent Pinchart, Vyacheslav Tyrtov,
	Aleksei Mateosian, Sasha Levin, Michal Hocko

Fix for the next compiler warnings:
mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
mm/cma_debug.c:67 cma_maxchunk_get() warn: should 'maxchunk << cma->order_per_bit' be a 64 bit type?

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Stefan Strogin <stefan.strogin@gmail.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Pintu Kumar <pintu.k@samsung.com>
Cc: Weijie Yang <weijie.yang@samsung.com>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Vyacheslav Tyrtov <v.tyrtov@samsung.com>
Cc: Aleksei Mateosian <a.mateosian@samsung.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Dmitry Safonov <d.safonov@partner.samsung.com>
---
 mm/cma_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index 835e761..9459842 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -42,7 +42,7 @@ static int cma_used_get(void *data, u64 *val)
 	/* pages counter is smaller than sizeof(int) */
 	used = bitmap_weight(cma->bitmap, (int)cma->count);
 	mutex_unlock(&cma->lock);
-	*val = used << cma->order_per_bit;
+	*val = (u64)used << cma->order_per_bit;
 
 	return 0;
 }
@@ -64,7 +64,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
 		maxchunk = max(end - start, maxchunk);
 	}
 	mutex_unlock(&cma->lock);
-	*val = maxchunk << cma->order_per_bit;
+	*val = (u64)maxchunk << cma->order_per_bit;
 
 	return 0;
 }
-- 
2.3.5

--
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>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3
  2015-04-08 19:45 ` [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3 Dmitry Safonov
@ 2015-04-08 20:55   ` Michal Nazarewicz
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Nazarewicz @ 2015-04-08 20:55 UTC (permalink / raw)
  To: Dmitry Safonov, dan.carpenter
  Cc: kbuild, stefan.strogin, akpm, linux-mm, Marek Szyprowski,
	Joonsoo Kim, Pintu Kumar, Weijie Yang, Laurent Pinchart,
	Vyacheslav Tyrtov, Aleksei Mateosian, Sasha Levin, Michal Hocko

On Wed, Apr 08 2015, Dmitry Safonov <d.safonov@partner.samsung.com> wrote:
> Fix for the next compiler warnings:
> mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
> mm/cma_debug.c:67 cma_maxchunk_get() warn: should 'maxchunk << cma->order_per_bit' be a 64 bit type?
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Michal Nazarewicz <mina86@mina86.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> Cc: Stefan Strogin <stefan.strogin@gmail.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> Cc: Pintu Kumar <pintu.k@samsung.com>
> Cc: Weijie Yang <weijie.yang@samsung.com>
> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Cc: Vyacheslav Tyrtov <v.tyrtov@samsung.com>
> Cc: Aleksei Mateosian <a.mateosian@samsung.com>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Cc: Michal Hocko <mhocko@suse.cz>
> Signed-off-by: Dmitry Safonov <d.safonov@partner.samsung.com>
> ---
>  mm/cma_debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/cma_debug.c b/mm/cma_debug.c
> index 835e761..9459842 100644
> --- a/mm/cma_debug.c
> +++ b/mm/cma_debug.c
> @@ -42,7 +42,7 @@ static int cma_used_get(void *data, u64 *val)
>  	/* pages counter is smaller than sizeof(int) */
>  	used = bitmap_weight(cma->bitmap, (int)cma->count);
>  	mutex_unlock(&cma->lock);
> -	*val = used << cma->order_per_bit;
> +	*val = (u64)used << cma->order_per_bit;
>  
>  	return 0;
>  }
> @@ -64,7 +64,7 @@ static int cma_maxchunk_get(void *data, u64 *val)
>  		maxchunk = max(end - start, maxchunk);
>  	}
>  	mutex_unlock(&cma->lock);
> -	*val = maxchunk << cma->order_per_bit;
> +	*val = (u64)maxchunk << cma->order_per_bit;
>  
>  	return 0;
>  }
> -- 
> 2.3.5
>

-- 
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-08 20:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 14:04 [next:master 9613/10050] mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type? Dan Carpenter
2015-04-08 19:45 ` [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3 Dmitry Safonov
2015-04-08 20:55   ` Michal Nazarewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).