History

sched/rt: fix build error when CONFIG_SYSCTL is disable

Avoid random build errors which do not select CONFIG_SYSCTL by depending on it in Kconfig. This fixes the following warning: In file included from kernel/sched/build_policy.c:43: At top level: kernel/sched/rt.c:3017:12: error: ‘sched_rr_handler’ defined but not used [-Werror=unused-function] 3017 | static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, | ^~~~~~~~~~~~~~~~ kernel/sched/rt.c:2978:12: error: ‘sched_rt_handler’ defined but not used [-Werror=unused-function] 2978 | static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, | ^~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:310: kernel/sched/build_policy.o] Error 1 make[1]: *** [scripts/Makefile.build:638: kernel/sched] Error 2 make[1]: *** Waiting for unfinished jobs....

Baisong Zhong committed 4 years ago

Commit 28f152c1 parent dafd7a91 file · +9 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/rt.c+9−2
@@ -5,7 +5,6 @@ · 4 unmodified lines
55 */
66
77 int sched_rr_timeslice = RR_TIMESLICE;
8−static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
98 /* More than 4 hours if BW_SHIFT equals 20. */
109 static const u64 max_rt_runtime = MAX_BW;
1110
@@ -25,11 +24,12 @@ unsigned int sysctl_sched_rt_period = 1000000; · 13 unmodified lines
2524 */
2625 int sysctl_sched_rt_runtime = 950000;
2726
27+#ifdef CONFIG_SYSCTL
28+static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
2829 static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
2930 size_t *lenp, loff_t *ppos);
3031 static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
3132 size_t *lenp, loff_t *ppos);
32−#ifdef CONFIG_SYSCTL
3333 static struct ctl_table sched_rt_sysctls[] = {
3434 {
3535 .procname = "sched_rt_period_us",
@@ -2911,6 +2911,7 @@ long sched_group_rt_period(struct task_group *tg) · 2875 unmodified lines
29112911 return rt_period_us;
29122912 }
29132913
2914+#ifdef CONFIG_SYSCTL
29142915 static int sched_rt_global_constraints(void)
29152916 {
29162917 int ret = 0;
@@ -2921,6 +2922,7 @@ static int sched_rt_global_constraints(void) · 4 unmodified lines
29212922
29222923 return ret;
29232924 }
2925+#endif /* CONFIG_SYSCTL */
29242926
29252927 int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
29262928 {
@@ -2932,6 +2934,8 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) · 5 unmodified lines
29322934 }
29332935
29342936 #else /* !CONFIG_RT_GROUP_SCHED */
2937+
2938+#ifdef CONFIG_SYSCTL
29352939 static int sched_rt_global_constraints(void)
29362940 {
29372941 unsigned long flags;
@@ -2949,8 +2953,10 @@ static int sched_rt_global_constraints(void) · 11 unmodified lines
29492953
29502954 return 0;
29512955 }
2956+#endif /* CONFIG_SYSCTL */
29522957 #endif /* CONFIG_RT_GROUP_SCHED */
29532958
2959+#ifdef CONFIG_SYSCTL
29542960 static int sched_rt_global_validate(void)
29552961 {
29562962 if (sysctl_sched_rt_period <= 0)
@@ -3035,6 +3041,7 @@ static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, · 78 unmodified lines
30353041
30363042 return ret;
30373043 }
3044+#endif /* CONFIG_SYSCTL */
30383045
30393046 #ifdef CONFIG_SCHED_DEBUG
30403047 void print_rt_stats(struct seq_file *m, int cpu)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t