In previous code sysctl_sched_cfs_boost is limited to only set value in the range [0..100], and cannot set negative value to proc node /proc/sys/kernel/sched_cfs_boost.
So this patch is to change sysctl_sched_cfs_boost as 'int' type and change its range to [-100..100] in sysctl.
Signed-off-by: Leo Yan leo.yan@linaro.org --- include/linux/sched/sysctl.h | 6 +++--- kernel/sched/tune.c | 2 +- kernel/sysctl.c | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index d68e88c..0d29f58 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -88,16 +88,16 @@ extern unsigned int sysctl_sched_cfs_bandwidth_slice; #endif
#ifdef CONFIG_SCHED_TUNE -extern unsigned int sysctl_sched_cfs_boost; +extern int sysctl_sched_cfs_boost; int sysctl_sched_cfs_boost_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos); -static inline unsigned int get_sysctl_sched_cfs_boost(void) +static inline int get_sysctl_sched_cfs_boost(void) { return sysctl_sched_cfs_boost; } #else -static inline unsigned int get_sysctl_sched_cfs_boost(void) +static inline int get_sysctl_sched_cfs_boost(void) { return 0; } diff --git a/kernel/sched/tune.c b/kernel/sched/tune.c index ba1fdfb..b2eefe7 100644 --- a/kernel/sched/tune.c +++ b/kernel/sched/tune.c @@ -15,7 +15,7 @@ static bool schedtune_initialized = false; #endif
-unsigned int sysctl_sched_cfs_boost __read_mostly; +int sysctl_sched_cfs_boost __read_mostly;
extern struct target_nrg schedtune_target_nrg;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index d964422..91272da 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -126,7 +126,8 @@ static int __maybe_unused one = 1; static int __maybe_unused two = 2; static int __maybe_unused four = 4; static unsigned long one_ul = 1; -static int one_hundred = 100; +static int __maybe_unused one_hundred = 100; +static int __maybe_unused neg_one_hundred = -100; #ifdef CONFIG_PRINTK static int ten_thousand = 10000; #endif @@ -504,7 +505,7 @@ static struct ctl_table kern_table[] = { .mode = 0644, #endif .proc_handler = &sysctl_sched_cfs_boost_handler, - .extra1 = &zero, + .extra1 = &neg_one_hundred, .extra2 = &one_hundred, }, #endif -- 1.9.1