Skip to contentSkip to conversation

mm: memcg: declare do_memsw_account inline

PATCH Applied John Sperbeck 2 participants 2 messages Nov 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: memcg: declare do_memsw_account inline

In commit 66d60c428b23 ("mm: memcg: move legacy memcg event code into memcontrol-v1.c"), the static do_memsw_account() function was moved from a .c file to a .h file. Unfortunately, the traditional inline keyword wasn't added. If a file (e.g., a unit test) includes the .h file, but doesn't refer to do_memsw_account(), it will get a warning like:

mm/memcontrol-v1.h:41:13: warning: unused function 'do_memsw_account' [-Wunused-function]
41 | static bool do_memsw_account(void)

      |             ^~~~~~~~~~~~~~~~
Fixes 66d60c428b23 ("mm: memcg: move legacy memcg event code into memcontrol-v1.c")
---
 mm/memcontrol-v1.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol-v1.h +1 -1
index 0e3b82951d91..144d71b65907 100644
@@ -38,7 +38,7 @@ void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n);
 	     iter = mem_cgroup_iter(NULL, iter, NULL))
 
 /* Whether legacy memory+swap accounting is active */
-static bool do_memsw_account(void)
+static inline bool do_memsw_account(void)
 {
 	return !cgroup_subsys_on_dfl(memory_cgrp_subsys);
 }
Signature · 1 line
2.47.0.338.g60cca15819-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · John Sperbeck

In commit 66d60c428b23 ("mm: memcg: move legacy memcg event code into memcontrol-v1.c"), the static do_memsw_account() function was moved from a .c file to a .h file. Unfortunately, the traditional inline keyword wasn't added. If a file (e.g., a unit test) includes the .h file, but doesn't refer to do_memsw_account(), it will get a warning like:

Quoted 6 lines

mm/memcontrol-v1.h:41:13: warning: unused function 'do_memsw_account' [-Wunused-function]
41 | static bool do_memsw_account(void)

      |             ^~~~~~~~~~~~~~~~
Fixes 66d60c428b23 ("mm: memcg: move legacy memcg event code into memcontrol-v1.c")

Thanks!