sched: Use bitmask for sched_busy_hysteresis_enable_cpus tunable

The current code is using a bitmap for sched_busy_hysteresis_enable_cpus
tunable. Since the feature is not enabled for any of the CPUs, the
default value is printed as "\n". This is very inconvenient for
user space applications which tries to write a new value and try to
restore the previous value. Like other scheduler tunables, use
the bitmask to avoid this issue.

Change-Id: I0c5989606352be5382dd688602aefd753fb62317
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 97ec1e6..32ed61b2 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 7555dc9..5fb03f9 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 bd86839..9e49f5a 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