1 #ifdef CONFIG_SCHED_AUTOGROUP
3 #include <linux/kref.h>
4 #include <linux/rwsem.h>
5 #include <linux/sched/autogroup.h>
9 * reference doesn't mean how many thread attach to this
10 * autogroup now. It just stands for the number of task
11 * could use this autogroup.
14 struct task_group
*tg
;
15 struct rw_semaphore lock
;
20 extern void autogroup_init(struct task_struct
*init_task
);
21 extern void autogroup_free(struct task_group
*tg
);
23 static inline bool task_group_is_autogroup(struct task_group
*tg
)
25 return !!tg
->autogroup
;
28 extern bool task_wants_autogroup(struct task_struct
*p
, struct task_group
*tg
);
30 static inline struct task_group
*
31 autogroup_task_group(struct task_struct
*p
, struct task_group
*tg
)
33 int enabled
= READ_ONCE(sysctl_sched_autogroup_enabled
);
35 if (enabled
&& task_wants_autogroup(p
, tg
))
36 return p
->signal
->autogroup
->tg
;
41 extern int autogroup_path(struct task_group
*tg
, char *buf
, int buflen
);
43 #else /* !CONFIG_SCHED_AUTOGROUP */
45 static inline void autogroup_init(struct task_struct
*init_task
) { }
46 static inline void autogroup_free(struct task_group
*tg
) { }
47 static inline bool task_group_is_autogroup(struct task_group
*tg
)
52 static inline struct task_group
*
53 autogroup_task_group(struct task_struct
*p
, struct task_group
*tg
)
58 #ifdef CONFIG_SCHED_DEBUG
59 static inline int autogroup_path(struct task_group
*tg
, char *buf
, int buflen
)
65 #endif /* CONFIG_SCHED_AUTOGROUP */