sched: move autogroup sysctls into its own file
move autogroup sysctls to autogroup.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20220128095025.8745-1-nizhen@uniontech.com
This commit is contained in:
parent
127b6429d2
commit
c8eaf6ac76
|
@ -45,10 +45,6 @@ extern unsigned int sysctl_sched_uclamp_util_min_rt_default;
|
||||||
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
|
extern unsigned int sysctl_sched_cfs_bandwidth_slice;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_AUTOGROUP
|
|
||||||
extern unsigned int sysctl_sched_autogroup_enabled;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int sysctl_sched_rr_timeslice;
|
extern int sysctl_sched_rr_timeslice;
|
||||||
extern int sched_rr_timeslice;
|
extern int sched_rr_timeslice;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,28 @@ unsigned int __read_mostly sysctl_sched_autogroup_enabled = 1;
|
||||||
static struct autogroup autogroup_default;
|
static struct autogroup autogroup_default;
|
||||||
static atomic_t autogroup_seq_nr;
|
static atomic_t autogroup_seq_nr;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSCTL
|
||||||
|
static struct ctl_table sched_autogroup_sysctls[] = {
|
||||||
|
{
|
||||||
|
.procname = "sched_autogroup_enabled",
|
||||||
|
.data = &sysctl_sched_autogroup_enabled,
|
||||||
|
.maxlen = sizeof(unsigned int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ZERO,
|
||||||
|
.extra2 = SYSCTL_ONE,
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void __init sched_autogroup_sysctl_init(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", sched_autogroup_sysctls);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define sched_autogroup_sysctl_init() do { } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
void __init autogroup_init(struct task_struct *init_task)
|
void __init autogroup_init(struct task_struct *init_task)
|
||||||
{
|
{
|
||||||
autogroup_default.tg = &root_task_group;
|
autogroup_default.tg = &root_task_group;
|
||||||
|
@ -198,6 +220,7 @@ void sched_autogroup_exit(struct signal_struct *sig)
|
||||||
static int __init setup_autogroup(char *str)
|
static int __init setup_autogroup(char *str)
|
||||||
{
|
{
|
||||||
sysctl_sched_autogroup_enabled = 0;
|
sysctl_sched_autogroup_enabled = 0;
|
||||||
|
sched_autogroup_sysctl_init();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ extern bool task_wants_autogroup(struct task_struct *p, struct task_group *tg);
|
||||||
static inline struct task_group *
|
static inline struct task_group *
|
||||||
autogroup_task_group(struct task_struct *p, struct task_group *tg)
|
autogroup_task_group(struct task_struct *p, struct task_group *tg)
|
||||||
{
|
{
|
||||||
|
extern unsigned int sysctl_sched_autogroup_enabled;
|
||||||
int enabled = READ_ONCE(sysctl_sched_autogroup_enabled);
|
int enabled = READ_ONCE(sysctl_sched_autogroup_enabled);
|
||||||
|
|
||||||
if (enabled && task_wants_autogroup(p, tg))
|
if (enabled && task_wants_autogroup(p, tg))
|
||||||
|
|
|
@ -1750,17 +1750,6 @@ static struct ctl_table kern_table[] = {
|
||||||
.proc_handler = sysctl_sched_uclamp_handler,
|
.proc_handler = sysctl_sched_uclamp_handler,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SCHED_AUTOGROUP
|
|
||||||
{
|
|
||||||
.procname = "sched_autogroup_enabled",
|
|
||||||
.data = &sysctl_sched_autogroup_enabled,
|
|
||||||
.maxlen = sizeof(unsigned int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ZERO,
|
|
||||||
.extra2 = SYSCTL_ONE,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_CFS_BANDWIDTH
|
#ifdef CONFIG_CFS_BANDWIDTH
|
||||||
{
|
{
|
||||||
.procname = "sched_cfs_bandwidth_slice_us",
|
.procname = "sched_cfs_bandwidth_slice_us",
|
||||||
|
|
Loading…
Reference in New Issue