[PATCH 3/3] sched/autogroup: Change autogroup_path() into a static inline function

From: Dietmar Eggemann
Date: Mon Sep 07 2020 - 05:17:50 EST


cfs_rq_tg_path() uses, besides cgroup_path(), autogroup_path() to
format the path of a taskgroup or autogroup respectively.

Provide autogroup_path() as a static inline function like cgroup_path()
so cfs_rq_tg_path() (from a tp-2-te converter) can use both in a kernel
module build.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
---
kernel/sched/autogroup.c | 8 --------
kernel/sched/autogroup.h | 8 +++++++-
2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/kernel/sched/autogroup.c b/kernel/sched/autogroup.c
index 2067080bb235..3c6c78d909dd 100644
--- a/kernel/sched/autogroup.c
+++ b/kernel/sched/autogroup.c
@@ -258,11 +258,3 @@ void proc_sched_autogroup_show_task(struct task_struct *p, struct seq_file *m)
autogroup_kref_put(ag);
}
#endif /* CONFIG_PROC_FS */
-
-int autogroup_path(struct task_group *tg, char *buf, int buflen)
-{
- if (!task_group_is_autogroup(tg))
- return 0;
-
- return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
-}
diff --git a/kernel/sched/autogroup.h b/kernel/sched/autogroup.h
index b96419974a1f..001f4826d781 100644
--- a/kernel/sched/autogroup.h
+++ b/kernel/sched/autogroup.h
@@ -35,7 +35,13 @@ autogroup_task_group(struct task_struct *p, struct task_group *tg)
return tg;
}

-extern int autogroup_path(struct task_group *tg, char *buf, int buflen);
+static inline int autogroup_path(struct task_group *tg, char *buf, int buflen)
+{
+ if (!task_group_is_autogroup(tg))
+ return 0;
+
+ return snprintf(buf, buflen, "%s-%ld", "/autogroup", tg->autogroup->id);
+}

#else /* !CONFIG_SCHED_AUTOGROUP */

--
2.17.1