Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1045189e authored by Junjie Wu's avatar Junjie Wu
Browse files

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: I47e666f835752528331f50b1e76784e6d67f8bcf
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent 9aa44be6
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -873,12 +873,18 @@ static ssize_t store_timer_rate(struct cpufreq_interactive_tunables *tunables,
		const char *buf, size_t count)
		const char *buf, size_t count)
{
{
	int ret;
	int ret;
	unsigned long val;
	unsigned long val, val_round;


	ret = strict_strtoul(buf, 0, &val);
	ret = strict_strtoul(buf, 0, &val);
	if (ret < 0)
	if (ret < 0)
		return ret;
		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;
	return count;
}
}