All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Vladimir Davydov
	<vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>,
	Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>
Cc: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	"Matthew Wilcox (Oracle)"
	<willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Waiman Long <longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] memcg, kmem: mark cancel_charge() inline
Date: Fri, 22 Oct 2021 09:05:35 +0200	[thread overview]
Message-ID: <20211022070542.679839-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

cancel_charge() is no longer called for CONFIG_MEMCG_KMEM on NOMMU
targets, which causes a compiletime warning:

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

Remove the now-incorrect #ifdef and just mark the function
'inline' like the other related helpers. This is simpler
and means we no longer have to match the #ifdef with the
caller.

Fixes: 5f3345c17079 ("memcg, kmem: further deprecate kmem.limit_in_bytes")
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
The 5f3345c17079 commit is in -mm, so the commit ID is not
stable. Feel free to just fold this into the other patch, or
take out that reference
---
 mm/memcontrol.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6538595994d2..9edccfeac804 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2770,8 +2770,7 @@ static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	return try_charge_memcg(memcg, gfp_mask, nr_pages);
 }
 
-#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MMU)
-static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
+static inline void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 {
 	if (mem_cgroup_is_root(memcg))
 		return;
@@ -2780,7 +2779,6 @@ static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 	if (do_memsw_account())
 		page_counter_uncharge(&memcg->memsw, nr_pages);
 }
-#endif
 
 static void commit_charge(struct folio *folio, struct mem_cgroup *memcg)
 {
-- 
2.29.2


WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Muchun Song <songmuchun@bytedance.com>,
	Roman Gushchin <guro@fb.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Shakeel Butt <shakeelb@google.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Waiman Long <longman@redhat.com>,
	cgroups@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] memcg, kmem: mark cancel_charge() inline
Date: Fri, 22 Oct 2021 09:05:35 +0200	[thread overview]
Message-ID: <20211022070542.679839-1-arnd@kernel.org> (raw)

From: Arnd Bergmann <arnd@arndb.de>

cancel_charge() is no longer called for CONFIG_MEMCG_KMEM on NOMMU
targets, which causes a compiletime warning:

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

Remove the now-incorrect #ifdef and just mark the function
'inline' like the other related helpers. This is simpler
and means we no longer have to match the #ifdef with the
caller.

Fixes: 5f3345c17079 ("memcg, kmem: further deprecate kmem.limit_in_bytes")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
The 5f3345c17079 commit is in -mm, so the commit ID is not
stable. Feel free to just fold this into the other patch, or
take out that reference
---
 mm/memcontrol.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6538595994d2..9edccfeac804 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2770,8 +2770,7 @@ static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	return try_charge_memcg(memcg, gfp_mask, nr_pages);
 }
 
-#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MMU)
-static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
+static inline void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 {
 	if (mem_cgroup_is_root(memcg))
 		return;
@@ -2780,7 +2779,6 @@ static void cancel_charge(struct mem_cgroup *memcg, unsigned int nr_pages)
 	if (do_memsw_account())
 		page_counter_uncharge(&memcg->memsw, nr_pages);
 }
-#endif
 
 static void commit_charge(struct folio *folio, struct mem_cgroup *memcg)
 {
-- 
2.29.2



             reply	other threads:[~2021-10-22  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22  7:05 Arnd Bergmann [this message]
2021-10-22  7:05 ` [PATCH] memcg, kmem: mark cancel_charge() inline Arnd Bergmann
2021-10-22  7:22 ` Muchun Song
2021-10-22  8:05 ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211022070542.679839-1-arnd@kernel.org \
    --to=arnd-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=guro-b10kYP2dOMg@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=longman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.