linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: memcontrol: fix an unused-function warning
@ 2020-05-28  9:56 Arnd Bergmann
  2020-05-28 17:15 ` Johannes Weiner
  2020-05-29  8:19 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-05-28  9:56 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko, Vladimir Davydov, Andrew Morton,
	Stephen Rothwell, Joonsoo Kim
  Cc: Arnd Bergmann, Alex Shi, Hugh Dickins, Kirill A. Shutemov,
	Michal Hocko, Roman Gushchin, Shakeel Butt, Balbir Singh,
	Chris Down, Yafang Shao, Tejun Heo, cgroups, linux-mm,
	linux-kernel

On NOMMU kernels without CONFIG_MEMCG_KMEM, we now get a harmless
warning about an unused function:

mm/memcontrol.c:2595:13: error: unused function 'cancel_charge' [-Werror,-Wunused-function]

Hide this function in a matching #ifdef.

Fixes: 5bd144bf764c ("mm: memcontrol: drop unused try/commit/cancel charge API")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f14da7a7348b..7bfca0abb8e1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2592,6 +2592,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	return 0;
 }
 
+#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MMU)
 static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 {
 	if (mem_cgroup_is_root(memcg))
@@ -2603,6 +2604,7 @@ static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 
 	css_put_many(&memcg->css, nr_pages);
 }
+#endif
 
 static void commit_charge(struct page *page, struct mem_cgroup *memcg)
 {
-- 
2.26.2



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

* Re: [PATCH] mm: memcontrol: fix an unused-function warning
  2020-05-28  9:56 [PATCH] mm: memcontrol: fix an unused-function warning Arnd Bergmann
@ 2020-05-28 17:15 ` Johannes Weiner
  2020-05-29  8:19 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2020-05-28 17:15 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Michal Hocko, Vladimir Davydov, Andrew Morton, Stephen Rothwell,
	Joonsoo Kim, Alex Shi, Hugh Dickins, Kirill A. Shutemov,
	Michal Hocko, Roman Gushchin, Shakeel Butt, Balbir Singh,
	Chris Down, Yafang Shao, Tejun Heo, cgroups, linux-mm,
	linux-kernel

On Thu, May 28, 2020 at 11:56:26AM +0200, Arnd Bergmann wrote:
> On NOMMU kernels without CONFIG_MEMCG_KMEM, we now get a harmless
> warning about an unused function:
> 
> mm/memcontrol.c:2595:13: error: unused function 'cancel_charge' [-Werror,-Wunused-function]
> 
> Hide this function in a matching #ifdef.
> 
> Fixes: 5bd144bf764c ("mm: memcontrol: drop unused try/commit/cancel charge API")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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

Thanks Arnd!


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

* Re: [PATCH] mm: memcontrol: fix an unused-function warning
  2020-05-28  9:56 [PATCH] mm: memcontrol: fix an unused-function warning Arnd Bergmann
  2020-05-28 17:15 ` Johannes Weiner
@ 2020-05-29  8:19 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2020-05-29  8:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Johannes Weiner, Vladimir Davydov, Andrew Morton,
	Stephen Rothwell, Joonsoo Kim, Alex Shi, Hugh Dickins,
	Kirill A. Shutemov, Roman Gushchin, Shakeel Butt, Balbir Singh,
	Chris Down, Yafang Shao, Tejun Heo, cgroups, linux-mm,
	linux-kernel

On Thu 28-05-20 11:56:26, Arnd Bergmann wrote:
> On NOMMU kernels without CONFIG_MEMCG_KMEM, we now get a harmless
> warning about an unused function:
> 
> mm/memcontrol.c:2595:13: error: unused function 'cancel_charge' [-Werror,-Wunused-function]
> 
> Hide this function in a matching #ifdef.
> 
> Fixes: 5bd144bf764c ("mm: memcontrol: drop unused try/commit/cancel charge API")

This is a linux-next sha1 which is not valid anymore. I would just drop
the tag.

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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

Thanks!
> ---
>  mm/memcontrol.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index f14da7a7348b..7bfca0abb8e1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -2592,6 +2592,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
>  	return 0;
>  }
>  
> +#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MMU)
>  static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
>  {
>  	if (mem_cgroup_is_root(memcg))
> @@ -2603,6 +2604,7 @@ static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
>  
>  	css_put_many(&memcg->css, nr_pages);
>  }
> +#endif
>  
>  static void commit_charge(struct page *page, struct mem_cgroup *memcg)
>  {
> -- 
> 2.26.2
> 

-- 
Michal Hocko
SUSE Labs


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

end of thread, other threads:[~2020-05-29  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28  9:56 [PATCH] mm: memcontrol: fix an unused-function warning Arnd Bergmann
2020-05-28 17:15 ` Johannes Weiner
2020-05-29  8:19 ` Michal Hocko

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