1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifdef CONFIG_SCHED_AUTOGROUP
6 * Reference doesn't mean how many threads attach to this
7 * autogroup now. It just stands for the number of tasks
8 * which could use this autogroup.
11 struct task_group *tg;
12 struct rw_semaphore lock;
17 extern void autogroup_init(struct task_struct *init_task);
18 extern void autogroup_free(struct task_group *tg);
20 static inline bool task_group_is_autogroup(struct task_group *tg)
22 return !!tg->autogroup;
25 extern bool task_wants_autogroup(struct task_struct *p, struct task_group *tg);
27 static inline struct task_group *
28 autogroup_task_group(struct task_struct *p, struct task_group *tg)
30 int enabled = READ_ONCE(sysctl_sched_autogroup_enabled);
32 if (enabled && task_wants_autogroup(p, tg))
33 return p->signal->autogroup->tg;
38 extern int autogroup_path(struct task_group *tg, char *buf, int buflen);
40 #else /* !CONFIG_SCHED_AUTOGROUP */
42 static inline void autogroup_init(struct task_struct *init_task) { }
43 static inline void autogroup_free(struct task_group *tg) { }
44 static inline bool task_group_is_autogroup(struct task_group *tg)
49 static inline struct task_group *
50 autogroup_task_group(struct task_struct *p, struct task_group *tg)
55 static inline int autogroup_path(struct task_group *tg, char *buf, int buflen)
60 #endif /* CONFIG_SCHED_AUTOGROUP */