From f777e92eb83b7089b20db525071251967542607f Mon Sep 17 00:00:00 2001 From: Amir Vajid Date: Tue, 14 Apr 2020 12:58:43 -0700 Subject: [PATCH] sched: walt: Improve the scheduler This change is for general scheduler improvements. Change-Id: I8e0a1d29ec170f6b628d63e685600da80c1aca8a Signed-off-by: Amir Vajid --- include/linux/sched/sysctl.h | 6 ++++- kernel/sched/walt.c | 6 +++++ kernel/sysctl.c | 43 ++++++++++++++---------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index bfab8222d9a7..c256acab81c9 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -48,8 +48,9 @@ extern unsigned int __weak sysctl_sched_task_unfilter_period; extern unsigned int __weak sysctl_sched_busy_hyst_enable_cpus; extern unsigned int __weak sysctl_sched_busy_hyst; extern unsigned int __weak sysctl_sched_coloc_busy_hyst_enable_cpus; -extern unsigned int __weak sysctl_sched_coloc_busy_hyst; +extern unsigned int __weak sysctl_sched_coloc_busy_hyst_cpu[NR_CPUS]; extern unsigned int __weak sysctl_sched_coloc_busy_hyst_max_ms; +extern unsigned int __weak sysctl_sched_coloc_busy_hyst_cpu_busy_pct[NR_CPUS]; extern unsigned int __weak sysctl_sched_window_stats_policy; extern unsigned int __weak sysctl_sched_ravg_window_nr_ticks; extern unsigned int __weak sysctl_sched_many_wakeup_threshold; @@ -77,6 +78,9 @@ sched_ravg_window_handler(struct ctl_table *table, int write, extern int sched_boost_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); + +extern int sched_busy_hyst_handler(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos); #endif #if defined(CONFIG_PREEMPTIRQ_EVENTS) || defined(CONFIG_PREEMPT_TRACER) diff --git a/kernel/sched/walt.c b/kernel/sched/walt.c index e1dd1150eb80..7903b81d526d 100644 --- a/kernel/sched/walt.c +++ b/kernel/sched/walt.c @@ -123,6 +123,12 @@ int __weak sched_boost_handler(struct ctl_table *table, int write, return -ENOSYS; } +int __weak sched_busy_hyst_handler(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + return -ENOSYS; +} + u64 __weak sched_ktime_clock(void) { return 0; } unsigned long __weak diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 234480f3611d..0eab7139acb9 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -64,7 +64,6 @@ #include #include #include -#include #include #include #include @@ -242,10 +241,6 @@ static int proc_dostring_coredump(struct ctl_table *table, int write, #endif static int proc_dopipe_max_size(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); -#ifdef CONFIG_SCHED_WALT -static int proc_douintvec_minmax_schedhyst(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos); -#endif #ifdef CONFIG_MAGIC_SYSRQ /* Note: sysrq code uses its own private copy */ @@ -513,7 +508,7 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_busy_hyst_enable_cpus, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_douintvec_minmax_schedhyst, + .proc_handler = sched_busy_hyst_handler, .extra1 = SYSCTL_ZERO, .extra2 = &two_hundred_fifty_five, }, @@ -522,7 +517,7 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_busy_hyst, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_douintvec_minmax_schedhyst, + .proc_handler = sched_busy_hyst_handler, .extra1 = SYSCTL_ZERO, .extra2 = &ns_per_sec, }, @@ -531,16 +526,16 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_coloc_busy_hyst_enable_cpus, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_douintvec_minmax_schedhyst, + .proc_handler = sched_busy_hyst_handler, .extra1 = SYSCTL_ZERO, .extra2 = &two_hundred_fifty_five, }, { - .procname = "sched_coloc_busy_hyst_ns", - .data = &sysctl_sched_coloc_busy_hyst, - .maxlen = sizeof(unsigned int), + .procname = "sched_coloc_busy_hyst_cpu_ns", + .data = &sysctl_sched_coloc_busy_hyst_cpu, + .maxlen = sizeof(unsigned int) * NR_CPUS, .mode = 0644, - .proc_handler = proc_douintvec_minmax_schedhyst, + .proc_handler = sched_busy_hyst_handler, .extra1 = SYSCTL_ZERO, .extra2 = &ns_per_sec, }, @@ -549,10 +544,19 @@ static struct ctl_table kern_table[] = { .data = &sysctl_sched_coloc_busy_hyst_max_ms, .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_douintvec_minmax_schedhyst, + .proc_handler = sched_busy_hyst_handler, .extra1 = SYSCTL_ZERO, .extra2 = &one_hundred_thousand, }, + { + .procname = "sched_coloc_busy_hyst_cpu_busy_pct", + .data = &sysctl_sched_coloc_busy_hyst_cpu_busy_pct, + .maxlen = sizeof(unsigned int) * NR_CPUS, + .mode = 0644, + .proc_handler = sched_busy_hyst_handler, + .extra1 = SYSCTL_ZERO, + .extra2 = &one_hundred, + }, { .procname = "sched_ravg_window_nr_ticks", .data = &sysctl_sched_ravg_window_nr_ticks, @@ -3165,19 +3169,6 @@ static int proc_dostring_coredump(struct ctl_table *table, int write, } #endif -#ifdef CONFIG_SCHED_WALT -static int proc_douintvec_minmax_schedhyst(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, loff_t *ppos) -{ - int ret = proc_douintvec_minmax(table, write, buffer, lenp, ppos); - - if (!ret && write) - sched_update_hyst_times(); - - return ret; -} -#endif - static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos,