From: Junjie Wu Date: Fri, 15 Aug 2014 23:34:37 +0000 (-0700) Subject: cpufreq: interactive: Round up timer_rate to match jiffy X-Git-Tag: firefly_0821_release~2958^2~244 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4db1f0ac8761fc30d4e1230939d623a52517bdcc;p=firefly-linux-kernel-4.4.55.git cpufreq: interactive: Round up timer_rate to match jiffy Timers are scheduled in unit of jiffies. Round up timer_rate so that it matches the actual sampling period. Change-Id: I88386a5a448e40333f9a9b9f0cf72af58cb54656 Signed-off-by: Junjie Wu --- diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index 49f206e48aa3..6bbcc905bb3e 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -855,12 +855,18 @@ static ssize_t store_timer_rate(struct cpufreq_interactive_tunables *tunables, const char *buf, size_t count) { int ret; - unsigned long val; + unsigned long val, val_round; ret = strict_strtoul(buf, 0, &val); if (ret < 0) return ret; - tunables->timer_rate = val; + + val_round = jiffies_to_usecs(usecs_to_jiffies(val)); + if (val != val_round) + pr_warn("timer_rate not aligned to jiffy. Rounded up to %lu\n", + val_round); + + tunables->timer_rate = val_round; return count; }