linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier
@ 2023-11-06  8:27 zhaimingbing
  2023-11-06 20:40 ` Randy Dunlap
  2023-11-07 16:32 ` [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: zhaimingbing @ 2023-11-06  8:27 UTC (permalink / raw)
  To: rdunlap, James.Bottomley; +Cc: linux-mm, linux-kernel, zhaimingbing

The long type should use "%ld" instead of "%lu".

Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
---
 mm/hugetlb_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
index dedd2edb0..3c132795c 100644
--- a/mm/hugetlb_cgroup.c
+++ b/mm/hugetlb_cgroup.c
@@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local)
 	else
 		max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]);
 
-	seq_printf(seq, "max %lu\n", max);
+	seq_printf(seq, "max %ld\n", max);
 
 	return 0;
 }
-- 
2.33.0





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

* Re: [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier
  2023-11-06  8:27 [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier zhaimingbing
@ 2023-11-06 20:40 ` Randy Dunlap
  2023-11-07 21:13   ` [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization zhaimingbing
  2023-11-07 16:32 ` [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2023-11-06 20:40 UTC (permalink / raw)
  To: zhaimingbing, James.Bottomley; +Cc: linux-mm, linux-kernel



On 11/6/23 00:27, zhaimingbing wrote:
> The long type should use "%ld" instead of "%lu".
> 
> Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  mm/hugetlb_cgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> index dedd2edb0..3c132795c 100644
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local)
>  	else
>  		max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]);
>  
> -	seq_printf(seq, "max %lu\n", max);
> +	seq_printf(seq, "max %ld\n", max);
>  
>  	return 0;
>  }

-- 
~Randy


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

* Re: [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier
  2023-11-06  8:27 [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier zhaimingbing
  2023-11-06 20:40 ` Randy Dunlap
@ 2023-11-07 16:32 ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2023-11-07 16:32 UTC (permalink / raw)
  To: zhaimingbing; +Cc: rdunlap, James.Bottomley, linux-mm, linux-kernel

On Mon,  6 Nov 2023 16:27:23 +0800 zhaimingbing <zhaimingbing@cmss.chinamobile.com> wrote:

> The long type should use "%ld" instead of "%lu".
> 
> ...
>
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -696,7 +696,7 @@ static int __hugetlb_events_show(struct seq_file *seq, bool local)
>  	else
>  		max = atomic_long_read(&h_cg->events[idx][HUGETLB_MAX]);
>  
> -	seq_printf(seq, "max %lu\n", max);
> +	seq_printf(seq, "max %ld\n", max);
>  
>  	return 0;
>  }

Well.  We can't have a negative number of events.  If we had an
atomic_ulong_t, we'd be using that for ->events[].

Perhaps giving `max' an unsigned long type would better represent the
intent in there.


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

* [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization
  2023-11-06 20:40 ` Randy Dunlap
@ 2023-11-07 21:13   ` zhaimingbing
  2023-11-10 21:02     ` Randy Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: zhaimingbing @ 2023-11-07 21:13 UTC (permalink / raw)
  To: rdunlap; +Cc: James.Bottomley, linux-kernel, linux-mm, zhaimingbing

Initialize 'max' with 'unsigned long' instead of 'long'.

Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
---
 mm/hugetlb_cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
index dedd2edb0..d4ca2ac55 100644
--- a/mm/hugetlb_cgroup.c
+++ b/mm/hugetlb_cgroup.c
@@ -685,7 +685,7 @@ static char *mem_fmt(char *buf, int size, unsigned long hsize)
 static int __hugetlb_events_show(struct seq_file *seq, bool local)
 {
 	int idx;
-	long max;
+	unsigned long max;
 	struct cftype *cft = seq_cft(seq);
 	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(seq_css(seq));
 
-- 
2.33.0





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

* Re: [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization
  2023-11-07 21:13   ` [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization zhaimingbing
@ 2023-11-10 21:02     ` Randy Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: Randy Dunlap @ 2023-11-10 21:02 UTC (permalink / raw)
  To: zhaimingbing; +Cc: James.Bottomley, linux-kernel, linux-mm



On 11/7/23 13:13, zhaimingbing wrote:
> Initialize 'max' with 'unsigned long' instead of 'long'.
> 

There is no variable initialization here, so the $Subject
does not match what is being changed.

Also there is no description of Why this change is needed.

> Signed-off-by: zhaimingbing <zhaimingbing@cmss.chinamobile.com>
> ---
>  mm/hugetlb_cgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
> index dedd2edb0..d4ca2ac55 100644
> --- a/mm/hugetlb_cgroup.c
> +++ b/mm/hugetlb_cgroup.c
> @@ -685,7 +685,7 @@ static char *mem_fmt(char *buf, int size, unsigned long hsize)
>  static int __hugetlb_events_show(struct seq_file *seq, bool local)
>  {
>  	int idx;
> -	long max;
> +	unsigned long max;
>  	struct cftype *cft = seq_cft(seq);
>  	struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(seq_css(seq));
>  

-- 
~Randy


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

end of thread, other threads:[~2023-11-10 21:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06  8:27 [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier zhaimingbing
2023-11-06 20:40 ` Randy Dunlap
2023-11-07 21:13   ` [PATCH V2] mm:hugetlb_cgroup: Optimize variable initialization zhaimingbing
2023-11-10 21:02     ` Randy Dunlap
2023-11-07 16:32 ` [PATCH] mm:hugetlb_cgroup: Fix the wrong format specifier Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox