All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: kmem: make __memcg_kmem_(un)charge static
@ 2021-01-08  2:03 Roman Gushchin
  2021-01-08 19:57   ` Shakeel Butt
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Gushchin @ 2021-01-08  2:03 UTC (permalink / raw)
  To: Andrew Morton, linux-mm
  Cc: Michal Hocko, Johannes Weiner, Shakeel Butt, linux-kernel,
	kernel-team, Roman Gushchin

I've noticed that __memcg_kmem_charge() and __memcg_kmem_uncharge()
are not used anywhere except memcontrol.c. Yet they are not declared
as non-static and are declared in memcontrol.h.

This patch makes them static.

Signed-off-by: Roman Gushchin <guro@fb.com>
---
 include/linux/memcontrol.h |  3 ---
 mm/memcontrol.c            | 11 ++++++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 41bbf71edd9f..7a38a1517a05 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1592,9 +1592,6 @@ static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg,
 #endif
 
 #ifdef CONFIG_MEMCG_KMEM
-int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
-			unsigned int nr_pages);
-void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages);
 int __memcg_kmem_charge_page(struct page *page, gfp_t gfp, int order);
 void __memcg_kmem_uncharge_page(struct page *page, int order);
 
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0d74b80fa4de..61f7c9ca14b7 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -255,6 +255,11 @@ struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr)
 #ifdef CONFIG_MEMCG_KMEM
 extern spinlock_t css_set_lock;
 
+static int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
+			       unsigned int nr_pages);
+static void __memcg_kmem_uncharge(struct mem_cgroup *memcg,
+				  unsigned int nr_pages);
+
 static void obj_cgroup_release(struct percpu_ref *ref)
 {
 	struct obj_cgroup *objcg = container_of(ref, struct obj_cgroup, refcnt);
@@ -3084,8 +3089,8 @@ static void memcg_free_cache_id(int id)
  *
  * Returns 0 on success, an error code on failure.
  */
-int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
-			unsigned int nr_pages)
+static int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
+			       unsigned int nr_pages)
 {
 	struct page_counter *counter;
 	int ret;
@@ -3117,7 +3122,7 @@ int __memcg_kmem_charge(struct mem_cgroup *memcg, gfp_t gfp,
  * @memcg: memcg to uncharge
  * @nr_pages: number of pages to uncharge
  */
-void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages)
+static void __memcg_kmem_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages)
 {
 	if (!cgroup_subsys_on_dfl(memory_cgrp_subsys))
 		page_counter_uncharge(&memcg->kmem, nr_pages);
-- 
2.26.2


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

* Re: [PATCH] mm: kmem: make __memcg_kmem_(un)charge static
  2021-01-08  2:03 [PATCH] mm: kmem: make __memcg_kmem_(un)charge static Roman Gushchin
@ 2021-01-08 19:57   ` Shakeel Butt
  0 siblings, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2021-01-08 19:57 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Andrew Morton, Linux MM, Michal Hocko, Johannes Weiner, LKML,
	Kernel Team

On Thu, Jan 7, 2021 at 6:03 PM Roman Gushchin <guro@fb.com> wrote:
>
> I've noticed that __memcg_kmem_charge() and __memcg_kmem_uncharge()
> are not used anywhere except memcontrol.c. Yet they are not declared
> as non-static and are declared in memcontrol.h.
>
> This patch makes them static.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>

Reviewed-by: Shakeel Butt <shakeelb@google.com>

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

* Re: [PATCH] mm: kmem: make __memcg_kmem_(un)charge static
@ 2021-01-08 19:57   ` Shakeel Butt
  0 siblings, 0 replies; 3+ messages in thread
From: Shakeel Butt @ 2021-01-08 19:57 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Andrew Morton, Linux MM, Michal Hocko, Johannes Weiner, LKML,
	Kernel Team

On Thu, Jan 7, 2021 at 6:03 PM Roman Gushchin <guro@fb.com> wrote:
>
> I've noticed that __memcg_kmem_charge() and __memcg_kmem_uncharge()
> are not used anywhere except memcontrol.c. Yet they are not declared
> as non-static and are declared in memcontrol.h.
>
> This patch makes them static.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>

Reviewed-by: Shakeel Butt <shakeelb@google.com>


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

end of thread, other threads:[~2021-01-08 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08  2:03 [PATCH] mm: kmem: make __memcg_kmem_(un)charge static Roman Gushchin
2021-01-08 19:57 ` Shakeel Butt
2021-01-08 19:57   ` Shakeel Butt

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.