diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 97ec1e60b6bd..32ed61b2072d 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -131,6 +131,6 @@ extern int sched_little_cluster_coloc_fmin_khz_handler(struct ctl_table *table, extern char sched_lib_name[LIB_PATH_LENGTH]; extern unsigned int sched_lib_mask_force; extern bool is_sched_lib_based_app(pid_t pid); -extern unsigned long *sched_busy_hysteresis_cpubits; +extern unsigned int sysctl_sched_busy_hysteresis_enable_cpus; #endif /* _LINUX_SCHED_SYSCTL_H */ diff --git a/kernel/sched/sched_avg.c b/kernel/sched/sched_avg.c index 7555dc98d33b..5fb03f94d8fd 100644 --- a/kernel/sched/sched_avg.c +++ b/kernel/sched/sched_avg.c @@ -26,9 +26,7 @@ static DEFINE_PER_CPU(unsigned long, iowait_prod_sum); static DEFINE_PER_CPU(spinlock_t, nr_lock) = __SPIN_LOCK_UNLOCKED(nr_lock); static s64 last_get_time; -static struct cpumask sched_busy_hysteresis_cpumask; -unsigned long *sched_busy_hysteresis_cpubits = - cpumask_bits(&sched_busy_hysteresis_cpumask); +unsigned int sysctl_sched_busy_hysteresis_enable_cpus; static DEFINE_PER_CPU(atomic64_t, last_busy_time) = ATOMIC64_INIT(0); #define NR_THRESHOLD_PCT 15 @@ -107,7 +105,7 @@ static inline void update_last_busy_time(int cpu, bool dequeue, { bool nr_run_trigger = false, load_trigger = false; - if (!cpumask_test_cpu(cpu, &sched_busy_hysteresis_cpumask)) + if (!(BIT(cpu) & sysctl_sched_busy_hysteresis_enable_cpus)) return; if (prev_nr_run >= BUSY_NR_RUN && per_cpu(nr, cpu) < BUSY_NR_RUN) diff --git a/kernel/sysctl.c b/kernel/sysctl.c index bd8683967762..9e49f5a5d382 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -442,10 +442,12 @@ static struct ctl_table kern_table[] = { }, { .procname = "sched_busy_hysteresis_enable_cpus", - .data = &sched_busy_hysteresis_cpubits, - .maxlen = NR_CPUS, + .data = &sysctl_sched_busy_hysteresis_enable_cpus, + .maxlen = sizeof(unsigned int), .mode = 0644, - .proc_handler = proc_do_large_bitmap, + .proc_handler = proc_douintvec_minmax, + .extra1 = &zero, + .extra2 = &two_hundred_fifty_five, }, #endif #ifdef CONFIG_SCHED_DEBUG