rt.c (b97d6790d03b763eca08847a9a5869a4291b9f9a) | rt.c (74fd1b8c4419ab9942ccf4e378adf3bd4a86dd69) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR 4 * policies) 5 */ 6 7int sched_rr_timeslice = RR_TIMESLICE; 8/* More than 4 hours if BW_SHIFT equals 20. */ --- 23 unchanged lines hidden (view full) --- 32 size_t *lenp, loff_t *ppos); 33static struct ctl_table sched_rt_sysctls[] = { 34 { 35 .procname = "sched_rt_period_us", 36 .data = &sysctl_sched_rt_period, 37 .maxlen = sizeof(unsigned int), 38 .mode = 0644, 39 .proc_handler = sched_rt_handler, | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Real-Time Scheduling Class (mapped to the SCHED_FIFO and SCHED_RR 4 * policies) 5 */ 6 7int sched_rr_timeslice = RR_TIMESLICE; 8/* More than 4 hours if BW_SHIFT equals 20. */ --- 23 unchanged lines hidden (view full) --- 32 size_t *lenp, loff_t *ppos); 33static struct ctl_table sched_rt_sysctls[] = { 34 { 35 .procname = "sched_rt_period_us", 36 .data = &sysctl_sched_rt_period, 37 .maxlen = sizeof(unsigned int), 38 .mode = 0644, 39 .proc_handler = sched_rt_handler, |
40 .extra1 = SYSCTL_ONE, 41 .extra2 = SYSCTL_INT_MAX, |
|
40 }, 41 { 42 .procname = "sched_rt_runtime_us", 43 .data = &sysctl_sched_rt_runtime, 44 .maxlen = sizeof(int), 45 .mode = 0644, 46 .proc_handler = sched_rt_handler, | 42 }, 43 { 44 .procname = "sched_rt_runtime_us", 45 .data = &sysctl_sched_rt_runtime, 46 .maxlen = sizeof(int), 47 .mode = 0644, 48 .proc_handler = sched_rt_handler, |
49 .extra1 = SYSCTL_NEG_ONE, 50 .extra2 = SYSCTL_INT_MAX, |
|
47 }, 48 { 49 .procname = "sched_rr_timeslice_ms", 50 .data = &sysctl_sched_rr_timeslice, 51 .maxlen = sizeof(int), 52 .mode = 0644, 53 .proc_handler = sched_rr_handler, 54 }, --- 2929 unchanged lines hidden (view full) --- 2984 return 0; 2985} 2986#endif /* CONFIG_SYSCTL */ 2987#endif /* CONFIG_RT_GROUP_SCHED */ 2988 2989#ifdef CONFIG_SYSCTL 2990static int sched_rt_global_validate(void) 2991{ | 51 }, 52 { 53 .procname = "sched_rr_timeslice_ms", 54 .data = &sysctl_sched_rr_timeslice, 55 .maxlen = sizeof(int), 56 .mode = 0644, 57 .proc_handler = sched_rr_handler, 58 }, --- 2929 unchanged lines hidden (view full) --- 2988 return 0; 2989} 2990#endif /* CONFIG_SYSCTL */ 2991#endif /* CONFIG_RT_GROUP_SCHED */ 2992 2993#ifdef CONFIG_SYSCTL 2994static int sched_rt_global_validate(void) 2995{ |
2992 if (sysctl_sched_rt_period <= 0) 2993 return -EINVAL; 2994 | |
2995 if ((sysctl_sched_rt_runtime != RUNTIME_INF) && 2996 ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) || 2997 ((u64)sysctl_sched_rt_runtime * 2998 NSEC_PER_USEC > max_rt_runtime))) 2999 return -EINVAL; 3000 3001 return 0; 3002} --- 14 unchanged lines hidden (view full) --- 3017 int old_period, old_runtime; 3018 static DEFINE_MUTEX(mutex); 3019 int ret; 3020 3021 mutex_lock(&mutex); 3022 old_period = sysctl_sched_rt_period; 3023 old_runtime = sysctl_sched_rt_runtime; 3024 | 2996 if ((sysctl_sched_rt_runtime != RUNTIME_INF) && 2997 ((sysctl_sched_rt_runtime > sysctl_sched_rt_period) || 2998 ((u64)sysctl_sched_rt_runtime * 2999 NSEC_PER_USEC > max_rt_runtime))) 3000 return -EINVAL; 3001 3002 return 0; 3003} --- 14 unchanged lines hidden (view full) --- 3018 int old_period, old_runtime; 3019 static DEFINE_MUTEX(mutex); 3020 int ret; 3021 3022 mutex_lock(&mutex); 3023 old_period = sysctl_sched_rt_period; 3024 old_runtime = sysctl_sched_rt_runtime; 3025 |
3025 ret = proc_dointvec(table, write, buffer, lenp, ppos); | 3026 ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
3026 3027 if (!ret && write) { 3028 ret = sched_rt_global_validate(); 3029 if (ret) 3030 goto undo; 3031 3032 ret = sched_dl_global_validate(); 3033 if (ret) --- 57 unchanged lines hidden --- | 3027 3028 if (!ret && write) { 3029 ret = sched_rt_global_validate(); 3030 if (ret) 3031 goto undo; 3032 3033 ret = sched_dl_global_validate(); 3034 if (ret) --- 57 unchanged lines hidden --- |