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
5 */5 */
6 6
7int sched_rr_timeslice = RR_TIMESLICE;7int sched_rr_timeslice = RR_TIMESLICE;
8static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
9/* More than 4 hours if BW_SHIFT equals 20. */8/* More than 4 hours if BW_SHIFT equals 20. */
10static const u64 max_rt_runtime = MAX_BW;9static const u64 max_rt_runtime = MAX_BW;
11 10
@@ -25,11 +24,12 @@ unsigned int sysctl_sched_rt_period = 1000000; · 13 unmodified lines
25 */24 */
26int sysctl_sched_rt_runtime = 950000;25int sysctl_sched_rt_runtime = 950000;
27 26
27#ifdef CONFIG_SYSCTL
28static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
28static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,29static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
29 size_t *lenp, loff_t *ppos);30 size_t *lenp, loff_t *ppos);
30static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,31static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
31 size_t *lenp, loff_t *ppos);32 size_t *lenp, loff_t *ppos);
32#ifdef CONFIG_SYSCTL
33static struct ctl_table sched_rt_sysctls[] = {33static struct ctl_table sched_rt_sysctls[] = {
34 {34 {
35 .procname = "sched_rt_period_us",35 .procname = "sched_rt_period_us",
@@ -2911,6 +2911,7 @@ long sched_group_rt_period(struct task_group *tg) · 2875 unmodified lines
2911 return rt_period_us;2911 return rt_period_us;
2912}2912}
2913 2913
2914#ifdef CONFIG_SYSCTL
2914static int sched_rt_global_constraints(void)2915static int sched_rt_global_constraints(void)
2915{2916{
2916 int ret = 0;2917 int ret = 0;
@@ -2921,6 +2922,7 @@ static int sched_rt_global_constraints(void) · 4 unmodified lines
2921 2922
2922 return ret;2923 return ret;
2923}2924}
2925#endif /* CONFIG_SYSCTL */
2924 2926
2925int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)2927int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk)
2926{2928{
@@ -2932,6 +2934,8 @@ int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) · 5 unmodified lines
2932}2934}
2933 2935
2934#else /* !CONFIG_RT_GROUP_SCHED */2936#else /* !CONFIG_RT_GROUP_SCHED */
2937
2938#ifdef CONFIG_SYSCTL
2935static int sched_rt_global_constraints(void)2939static int sched_rt_global_constraints(void)
2936{2940{
2937 unsigned long flags;2941 unsigned long flags;
@@ -2949,8 +2953,10 @@ static int sched_rt_global_constraints(void) · 11 unmodified lines
2949 2953
2950 return 0;2954 return 0;
2951}2955}
2956#endif /* CONFIG_SYSCTL */
2952#endif /* CONFIG_RT_GROUP_SCHED */2957#endif /* CONFIG_RT_GROUP_SCHED */
2953 2958
2959#ifdef CONFIG_SYSCTL
2954static int sched_rt_global_validate(void)2960static int sched_rt_global_validate(void)
2955{2961{
2956 if (sysctl_sched_rt_period <= 0)2962 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
3035 3041
3036 return ret;3042 return ret;
3037}3043}
3044#endif /* CONFIG_SYSCTL */
3038 3045
3039#ifdef CONFIG_SCHED_DEBUG3046#ifdef CONFIG_SCHED_DEBUG
3040void print_rt_stats(struct seq_file *m, int cpu)3047void 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