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....
Unified · Split
| @@ -5,7 +5,6 @@ · 4 unmodified lines | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | int sched_rr_timeslice = RR_TIMESLICE; | 7 | int sched_rr_timeslice = RR_TIMESLICE; |
| 8 | static 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. */ |
| 10 | static const u64 max_rt_runtime = MAX_BW; | 9 | static 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 | */ |
| 26 | int sysctl_sched_rt_runtime = 950000; | 25 | int sysctl_sched_rt_runtime = 950000; |
| 27 | 26 | ||
| 27 | #ifdef CONFIG_SYSCTL | ||
| 28 | static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE; | ||
| 28 | static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, | 29 | static 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); |
| 30 | static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, | 31 | static 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 | ||
| 33 | static struct ctl_table sched_rt_sysctls[] = { | 33 | static 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 | ||
| 2914 | static int sched_rt_global_constraints(void) | 2915 | static 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 | ||
| 2925 | int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk) | 2927 | int 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 | ||
| 2935 | static int sched_rt_global_constraints(void) | 2939 | static 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 | ||
| 2954 | static int sched_rt_global_validate(void) | 2960 | static 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_DEBUG | 3046 | #ifdef CONFIG_SCHED_DEBUG |
| 3040 | void print_rt_stats(struct seq_file *m, int cpu) | 3047 | void print_rt_stats(struct seq_file *m, int cpu) |