linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
@ 2014-12-06 16:45 Rickard Strandqvist
  2014-12-07 10:31 ` Michal Hocko
  2014-12-08 16:02 ` Johannes Weiner
  0 siblings, 2 replies; 8+ messages in thread
From: Rickard Strandqvist @ 2014-12-06 16:45 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko
  Cc: Rickard Strandqvist, cgroups, linux-mm, linux-kernel

Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
And move BUILD_BUG_ON() to the beginning of memcg_stat_show() instead.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 mm/memcontrol.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d6ac0e3..5e2f0f3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4379,17 +4379,14 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
 }
 #endif /* CONFIG_NUMA */
 
-static inline void mem_cgroup_lru_names_not_uptodate(void)
-{
-	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
-}
-
 static int memcg_stat_show(struct seq_file *m, void *v)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
 	struct mem_cgroup *mi;
 	unsigned int i;
 
+	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
+
 	for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) {
 		if (i == MEM_CGROUP_STAT_SWAP && !do_swap_account)
 			continue;
-- 
1.7.10.4


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

* Re: [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
  2014-12-06 16:45 [PATCH] mm: memcontrol.c: Cleaning up function that are not used anywhere Rickard Strandqvist
@ 2014-12-07 10:31 ` Michal Hocko
  2014-12-08 16:02 ` Johannes Weiner
  1 sibling, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2014-12-07 10:31 UTC (permalink / raw)
  To: Rickard Strandqvist; +Cc: Johannes Weiner, cgroups, linux-mm, linux-kernel

On Sat 06-12-14 17:45:56, Rickard Strandqvist wrote:
> Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
> And move BUILD_BUG_ON() to the beginning of memcg_stat_show() instead.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/memcontrol.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d6ac0e3..5e2f0f3 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4379,17 +4379,14 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
>  }
>  #endif /* CONFIG_NUMA */
>  
> -static inline void mem_cgroup_lru_names_not_uptodate(void)
> -{
> -	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
> -}
> -
>  static int memcg_stat_show(struct seq_file *m, void *v)
>  {
>  	struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
>  	struct mem_cgroup *mi;
>  	unsigned int i;
>  
> +	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
> +
>  	for (i = 0; i < MEM_CGROUP_STAT_NSTATS; i++) {
>  		if (i == MEM_CGROUP_STAT_SWAP && !do_swap_account)
>  			continue;
> -- 
> 1.7.10.4
> 

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
  2014-12-06 16:45 [PATCH] mm: memcontrol.c: Cleaning up function that are not used anywhere Rickard Strandqvist
  2014-12-07 10:31 ` Michal Hocko
@ 2014-12-08 16:02 ` Johannes Weiner
  1 sibling, 0 replies; 8+ messages in thread
From: Johannes Weiner @ 2014-12-08 16:02 UTC (permalink / raw)
  To: Rickard Strandqvist; +Cc: Michal Hocko, cgroups, linux-mm, linux-kernel

On Sat, Dec 06, 2014 at 05:45:56PM +0100, Rickard Strandqvist wrote:
> Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
> And move BUILD_BUG_ON() to the beginning of memcg_stat_show() instead.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

Looks good, thanks for following up.

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

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

* Re: [PATCH] mm: memcontrol.c: Cleaning up function that are not used anywhere
  2014-12-03 15:54   ` Michal Hocko
@ 2014-12-03 17:04     ` Rickard Strandqvist
  0 siblings, 0 replies; 8+ messages in thread
From: Rickard Strandqvist @ 2014-12-03 17:04 UTC (permalink / raw)
  To: Michal Hocko; +Cc: Johannes Weiner, cgroups, linux-mm, linux-kernel

2014-12-03 16:54 GMT+01:00 Michal Hocko <mhocko@suse.cz>:
> On Wed 03-12-14 10:22:31, Johannes Weiner wrote:
>> On Tue, Dec 02, 2014 at 11:41:23PM +0100, Rickard Strandqvist wrote:
>> > Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
>> >
>> > This was partially found by using a static code analysis program called cppcheck.
>> >
>> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> > ---
>> >  mm/memcontrol.c |    5 -----
>> >  1 file changed, 5 deletions(-)
>> >
>> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> > index d6ac0e3..5edd1fe 100644
>> > --- a/mm/memcontrol.c
>> > +++ b/mm/memcontrol.c
>> > @@ -4379,11 +4379,6 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
>> >  }
>> >  #endif /* CONFIG_NUMA */
>> >
>> > -static inline void mem_cgroup_lru_names_not_uptodate(void)
>> > -{
>> > -   BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
>> > -}
>>
>> That assertion doesn't work in an unused function, but we still want
>> this check.  Please move the BUILD_BUG_ON() to the beginning of
>> memcg_stat_show() instead.
>
> Ohh. I have completely missed the point of the check! Moving the check
> to memcg_stat_show sounds like a good idea.
>
> --
> Michal Hocko
> SUSE Labs

Hi

Ok, sure I'll fix that!

It will take a few days before I will have access to my workstation,
however, but the new patch on the way...

Kind regards
Rickard Strandqvist

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

* Re: [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
  2014-12-03 15:22 ` Johannes Weiner
@ 2014-12-03 15:54   ` Michal Hocko
  2014-12-03 17:04     ` Rickard Strandqvist
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Hocko @ 2014-12-03 15:54 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: Rickard Strandqvist, cgroups, linux-mm, linux-kernel

On Wed 03-12-14 10:22:31, Johannes Weiner wrote:
> On Tue, Dec 02, 2014 at 11:41:23PM +0100, Rickard Strandqvist wrote:
> > Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
> > 
> > This was partially found by using a static code analysis program called cppcheck.
> > 
> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> > ---
> >  mm/memcontrol.c |    5 -----
> >  1 file changed, 5 deletions(-)
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index d6ac0e3..5edd1fe 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4379,11 +4379,6 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
> >  }
> >  #endif /* CONFIG_NUMA */
> >  
> > -static inline void mem_cgroup_lru_names_not_uptodate(void)
> > -{
> > -	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
> > -}
> 
> That assertion doesn't work in an unused function, but we still want
> this check.  Please move the BUILD_BUG_ON() to the beginning of
> memcg_stat_show() instead.

Ohh. I have completely missed the point of the check! Moving the check
to memcg_stat_show sounds like a good idea.

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
  2014-12-02 22:41 Rickard Strandqvist
  2014-12-03  9:22 ` Michal Hocko
@ 2014-12-03 15:22 ` Johannes Weiner
  2014-12-03 15:54   ` Michal Hocko
  1 sibling, 1 reply; 8+ messages in thread
From: Johannes Weiner @ 2014-12-03 15:22 UTC (permalink / raw)
  To: Rickard Strandqvist; +Cc: Michal Hocko, cgroups, linux-mm, linux-kernel

On Tue, Dec 02, 2014 at 11:41:23PM +0100, Rickard Strandqvist wrote:
> Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  mm/memcontrol.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d6ac0e3..5edd1fe 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4379,11 +4379,6 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
>  }
>  #endif /* CONFIG_NUMA */
>  
> -static inline void mem_cgroup_lru_names_not_uptodate(void)
> -{
> -	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
> -}

That assertion doesn't work in an unused function, but we still want
this check.  Please move the BUILD_BUG_ON() to the beginning of
memcg_stat_show() instead.

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

* Re: [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
  2014-12-02 22:41 Rickard Strandqvist
@ 2014-12-03  9:22 ` Michal Hocko
  2014-12-03 15:22 ` Johannes Weiner
  1 sibling, 0 replies; 8+ messages in thread
From: Michal Hocko @ 2014-12-03  9:22 UTC (permalink / raw)
  To: Rickard Strandqvist; +Cc: Johannes Weiner, cgroups, linux-mm, linux-kernel

On Tue 02-12-14 23:41:23, Rickard Strandqvist wrote:
> Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

Acked-by: Michal Hocko <mhocko@suse.cz>

> ---
>  mm/memcontrol.c |    5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index d6ac0e3..5edd1fe 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4379,11 +4379,6 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
>  }
>  #endif /* CONFIG_NUMA */
>  
> -static inline void mem_cgroup_lru_names_not_uptodate(void)
> -{
> -	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
> -}
> -
>  static int memcg_stat_show(struct seq_file *m, void *v)
>  {
>  	struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
> -- 
> 1.7.10.4
> 

-- 
Michal Hocko
SUSE Labs

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

* [PATCH] mm: memcontrol.c:  Cleaning up function that are not used anywhere
@ 2014-12-02 22:41 Rickard Strandqvist
  2014-12-03  9:22 ` Michal Hocko
  2014-12-03 15:22 ` Johannes Weiner
  0 siblings, 2 replies; 8+ messages in thread
From: Rickard Strandqvist @ 2014-12-02 22:41 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko
  Cc: Rickard Strandqvist, cgroups, linux-mm, linux-kernel

Remove function mem_cgroup_lru_names_not_uptodate() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 mm/memcontrol.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d6ac0e3..5edd1fe 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4379,11 +4379,6 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v)
 }
 #endif /* CONFIG_NUMA */
 
-static inline void mem_cgroup_lru_names_not_uptodate(void)
-{
-	BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS);
-}
-
 static int memcg_stat_show(struct seq_file *m, void *v)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_css(seq_css(m));
-- 
1.7.10.4


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

end of thread, other threads:[~2014-12-08 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-06 16:45 [PATCH] mm: memcontrol.c: Cleaning up function that are not used anywhere Rickard Strandqvist
2014-12-07 10:31 ` Michal Hocko
2014-12-08 16:02 ` Johannes Weiner
  -- strict thread matches above, loose matches on Subject: below --
2014-12-02 22:41 Rickard Strandqvist
2014-12-03  9:22 ` Michal Hocko
2014-12-03 15:22 ` Johannes Weiner
2014-12-03 15:54   ` Michal Hocko
2014-12-03 17:04     ` Rickard Strandqvist

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