Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700292 > unrolled thread

[PATCH] mm/zsmalloc: Change stat type parameter to int

Started byMatthias Kaehlcke <mka@chromium.org>
First post2017-07-31 20:00 +0200
Last post2017-08-01 09:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm/zsmalloc: Change stat type parameter to int Matthias Kaehlcke <mka@chromium.org> - 2017-07-31 20:00 +0200
    Re: [PATCH] mm/zsmalloc: Change stat type parameter to int Minchan Kim <minchan@kernel.org> - 2017-08-01 09:00 +0200
    Re: [PATCH] mm/zsmalloc: Change stat type parameter to int Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-08-01 09:40 +0200

#1700292 — [PATCH] mm/zsmalloc: Change stat type parameter to int

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-07-31 20:00 +0200
Subject[PATCH] mm/zsmalloc: Change stat type parameter to int
Message-ID<u9n92-NK-57@gated-at.bofh.it>
zs_stat_inc/dec/get() uses enum zs_stat_type for the stat type, however
some callers pass an enum fullness_group value. Change the type to int
to reflect the actual use of the functions and get rid of
'enum-conversion' warnings

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
 mm/zsmalloc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 013eea76685e..8daf56b73024 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -551,20 +551,23 @@ static int get_size_class_index(int size)
 	return min_t(int, ZS_SIZE_CLASSES - 1, idx);
 }
 
+/* type can be of enum type zs_stat_type or fullness_group */
 static inline void zs_stat_inc(struct size_class *class,
-				enum zs_stat_type type, unsigned long cnt)
+				int type, unsigned long cnt)
 {
 	class->stats.objs[type] += cnt;
 }
 
+/* type can be of enum type zs_stat_type or fullness_group */
 static inline void zs_stat_dec(struct size_class *class,
-				enum zs_stat_type type, unsigned long cnt)
+				int type, unsigned long cnt)
 {
 	class->stats.objs[type] -= cnt;
 }
 
+/* type can be of enum type zs_stat_type or fullness_group */
 static inline unsigned long zs_stat_get(struct size_class *class,
-				enum zs_stat_type type)
+				int type)
 {
 	return class->stats.objs[type];
 }
-- 
2.14.0.rc0.400.g1c36432dff-goog

[toc] | [next] | [standalone]


#1700678

FromMinchan Kim <minchan@kernel.org>
Date2017-08-01 09:00 +0200
Message-ID<u9zjQ-8iL-9@gated-at.bofh.it>
In reply to#1700292
On Mon, Jul 31, 2017 at 10:50:00AM -0700, Matthias Kaehlcke wrote:
> zs_stat_inc/dec/get() uses enum zs_stat_type for the stat type, however
> some callers pass an enum fullness_group value. Change the type to int
> to reflect the actual use of the functions and get rid of
> 'enum-conversion' warnings

Maybe clang?
        
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Anyway,

Acked-by: Minchan Kim <minchan@kernel.org>

Thanks!

[toc] | [prev] | [next] | [standalone]


#1700692

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-08-01 09:40 +0200
Message-ID<u9zWx-iZ-1@gated-at.bofh.it>
In reply to#1700292
On (07/31/17 10:50), Matthias Kaehlcke wrote:
> zs_stat_inc/dec/get() uses enum zs_stat_type for the stat type, however
> some callers pass an enum fullness_group value. Change the type to int
> to reflect the actual use of the functions and get rid of
> 'enum-conversion' warnings
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>

Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web