Skip to content

Commit 84227c1

Browse files
nizhenthmcgrof
authored andcommitted
sched: Move deadline_period sysctls to deadline.c
move deadline_period sysctls to deadline.c and use the new register_sysctl_init() to register the sysctl interface. Signed-off-by: Zhen Ni <nizhen@uniontech.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent d9ab0e6 commit 84227c1

3 files changed

Lines changed: 34 additions & 25 deletions

File tree

include/linux/sched/sysctl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ extern int sysctl_numa_balancing_mode;
3131
#define sysctl_numa_balancing_mode 0
3232
#endif
3333

34-
extern unsigned int sysctl_sched_dl_period_max;
35-
extern unsigned int sysctl_sched_dl_period_min;
36-
3734
#ifdef CONFIG_UCLAMP_TASK
3835
extern unsigned int sysctl_sched_uclamp_util_min;
3936
extern unsigned int sysctl_sched_uclamp_util_max;

kernel/sched/deadline.c

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,40 @@
1616
* Fabio Checconi <fchecconi@gmail.com>
1717
*/
1818

19+
/*
20+
* Default limits for DL period; on the top end we guard against small util
21+
* tasks still getting ridiculously long effective runtimes, on the bottom end we
22+
* guard against timer DoS.
23+
*/
24+
static unsigned int sysctl_sched_dl_period_max = 1 << 22; /* ~4 seconds */
25+
static unsigned int sysctl_sched_dl_period_min = 100; /* 100 us */
26+
#ifdef CONFIG_SYSCTL
27+
static struct ctl_table sched_dl_sysctls[] = {
28+
{
29+
.procname = "sched_deadline_period_max_us",
30+
.data = &sysctl_sched_dl_period_max,
31+
.maxlen = sizeof(unsigned int),
32+
.mode = 0644,
33+
.proc_handler = proc_dointvec,
34+
},
35+
{
36+
.procname = "sched_deadline_period_min_us",
37+
.data = &sysctl_sched_dl_period_min,
38+
.maxlen = sizeof(unsigned int),
39+
.mode = 0644,
40+
.proc_handler = proc_dointvec,
41+
},
42+
{}
43+
};
44+
45+
static int __init sched_dl_sysctl_init(void)
46+
{
47+
register_sysctl_init("kernel", sched_dl_sysctls);
48+
return 0;
49+
}
50+
late_initcall(sched_dl_sysctl_init);
51+
#endif
52+
1953
static inline struct task_struct *dl_task_of(struct sched_dl_entity *dl_se)
2054
{
2155
return container_of(dl_se, struct task_struct, dl);
@@ -2879,14 +2913,6 @@ void __getparam_dl(struct task_struct *p, struct sched_attr *attr)
28792913
attr->sched_flags |= dl_se->flags;
28802914
}
28812915

2882-
/*
2883-
* Default limits for DL period; on the top end we guard against small util
2884-
* tasks still getting ridiculously long effective runtimes, on the bottom end we
2885-
* guard against timer DoS.
2886-
*/
2887-
unsigned int sysctl_sched_dl_period_max = 1 << 22; /* ~4 seconds */
2888-
unsigned int sysctl_sched_dl_period_min = 100; /* 100 us */
2889-
28902916
/*
28912917
* This function validates the new parameters of a -deadline task.
28922918
* We ask for the deadline not being zero, and greater or equal

kernel/sysctl.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,20 +1681,6 @@ static struct ctl_table kern_table[] = {
16811681
.extra2 = SYSCTL_FOUR,
16821682
},
16831683
#endif /* CONFIG_NUMA_BALANCING */
1684-
{
1685-
.procname = "sched_deadline_period_max_us",
1686-
.data = &sysctl_sched_dl_period_max,
1687-
.maxlen = sizeof(unsigned int),
1688-
.mode = 0644,
1689-
.proc_handler = proc_dointvec,
1690-
},
1691-
{
1692-
.procname = "sched_deadline_period_min_us",
1693-
.data = &sysctl_sched_dl_period_min,
1694-
.maxlen = sizeof(unsigned int),
1695-
.mode = 0644,
1696-
.proc_handler = proc_dointvec,
1697-
},
16981684
{
16991685
.procname = "sched_rr_timeslice_ms",
17001686
.data = &sysctl_sched_rr_timeslice,

0 commit comments

Comments
 (0)