From db713def08c043acdc63a9ce1989cc86c3ba13a4 Mon Sep 17 00:00:00 2001 From: Masahito S Date: Tue, 18 Apr 2023 02:02:43 +0900 Subject: [PATCH] constgran v2 for cachy sched: Make latency / granularity constant tunable_scaling = 1 (logarithmic) -> 0 (constant) latency_ns = variable 6-24ms -> constant 12.8ms min_granularity_ns = variable 0.75-3ms -> constant 1.6ms wakeup_granularity_ns = variable 1-4ms -> constant 9.6ms --- kernel/sched/fair.c | 51 +++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 86a988c83..2667d5cee 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -67,15 +67,17 @@ * (to see the precise effective timeslice length of your workload, * run vmstat and monitor the context-switches (cs) field) * - * (default: 6ms * (1 + ilog(ncpus)), units: nanoseconds) + * (BORE default: 12.8ms constant, units: nanoseconds) + * (CFS default: 6ms * (1 + ilog(ncpus)), units: nanoseconds) */ -#ifdef CONFIG_CACHY -unsigned int sysctl_sched_latency = 3000000ULL; -static unsigned int normalized_sysctl_sched_latency = 3000000ULL; -#else +#ifdef CONFIG_SCHED_BORE +unsigned int sysctl_sched_latency = 12800000ULL; +static unsigned int normalized_sysctl_sched_latency = 12800000ULL; +#else // CONFIG_SCHED_BORE unsigned int sysctl_sched_latency = 6000000ULL; static unsigned int normalized_sysctl_sched_latency = 6000000ULL; -#endif +#endif // CONFIG_SCHED_BORE + /* * The initial- and re-scaling of tunables is configurable * @@ -85,22 +87,28 @@ static unsigned int normalized_sysctl_sched_latency = 6000000ULL; * SCHED_TUNABLESCALING_LOG - scaled logarithmical, *1+ilog(ncpus) * SCHED_TUNABLESCALING_LINEAR - scaled linear, *ncpus * - * (default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus)) + * (BORE default SCHED_TUNABLESCALING_NONE = *1 constant) + * (CFS default SCHED_TUNABLESCALING_LOG = *(1+ilog(ncpus)) */ +#ifdef CONFIG_SCHED_BORE +unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_NONE; +#else // CONFIG_SCHED_BORE unsigned int sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_LOG; +#endif // CONFIG_SCHED_BORE /* * Minimal preemption granularity for CPU-bound tasks: * - * (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds) + * (BORE default: 1.6 msec constant, units: nanoseconds) + * (CFS default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds) */ -#ifdef CONFIG_CACHY -unsigned int sysctl_sched_min_granularity = 400000ULL; -static unsigned int normalized_sysctl_sched_min_granularity = 400000ULL; -#else +#ifdef CONFIG_SCHED_BORE +unsigned int sysctl_sched_min_granularity = 1600000ULL; +static unsigned int normalized_sysctl_sched_min_granularity = 1600000ULL; +#else // CONFIG_SCHED_BORE unsigned int sysctl_sched_min_granularity = 750000ULL; static unsigned int normalized_sysctl_sched_min_granularity = 750000ULL; -#endif +#endif // CONFIG_SCHED_BORE /* * Minimal preemption granularity for CPU-bound SCHED_IDLE tasks. @@ -128,15 +136,16 @@ unsigned int sysctl_sched_child_runs_first __read_mostly; * and reduces their over-scheduling. Synchronous workloads will still * have immediate wakeup/sleep latencies. * - * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds) + * (BORE default: 9.6 msec constant, units: nanoseconds) + * (CFS default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds) */ -#ifdef CONFIG_CACHY -unsigned int sysctl_sched_wakeup_granularity = 500000UL; -static unsigned int normalized_sysctl_sched_wakeup_granularity = 500000UL; -#else +#ifdef CONFIG_SCHED_BORE +unsigned int sysctl_sched_wakeup_granularity = 9600000UL; +static unsigned int normalized_sysctl_sched_wakeup_granularity = 9600000UL; +#else // CONFIG_SCHED_BORE unsigned int sysctl_sched_wakeup_granularity = 1000000UL; static unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL; -#endif +#endif // CONFIG_SCHED_BORE const_debug unsigned int sysctl_sched_migration_cost = 500000UL; @@ -189,12 +198,8 @@ int __weak arch_asym_cpu_priority(int cpu) * * (default: 5 msec, units: microseconds) */ -#ifdef CONFIG_CACHY -static unsigned int sysctl_sched_cfs_bandwidth_slice = 3000UL; -#else static unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; #endif -#endif #ifdef CONFIG_NUMA_BALANCING /* Restrict the NUMA promotion throughput (MB/s) for each target node. */ -- 2.25.1