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

Commit 19b3f3f8 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri Committed by Steve Muckle
Browse files

sched: Use absolute scale for notifying governor



Make the tunables used for deciding the need for notification to be on
absolute scale. The earlier scale (in percent terms relative to
cur_freq) does not work well with available range of frequencies. For
example, 100% tunable value would work well for lower range of
frequencies and not for higher range. Having the tunable to be on
absolute scale makes tuning more realistic.

Change-Id: I35a8c4e2f2e9da57f4ca4462072276d06ad386f1
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
parent 2568673d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@ extern unsigned int sysctl_sched_init_task_load_pct;
#endif

#ifdef CONFIG_SCHED_FREQ_INPUT
extern int sysctl_sched_freq_inc_notify_slack_pct;
extern int sysctl_sched_freq_dec_notify_slack_pct;
extern int sysctl_sched_freq_inc_notify;
extern int sysctl_sched_freq_dec_notify;
#endif

#ifdef CONFIG_SCHED_HMP
+16 −12
Original line number Diff line number Diff line
@@ -1153,8 +1153,17 @@ __read_mostly unsigned int sysctl_sched_freq_account_wait_time;
 */
__read_mostly unsigned int sysctl_sched_gov_response_time = 10000000;

__read_mostly int sysctl_sched_freq_inc_notify_slack_pct = -INT_MAX;
__read_mostly int sysctl_sched_freq_dec_notify_slack_pct = INT_MAX;
/*
 * For increase, send notification if
 *      freq_required - cur_freq > sysctl_sched_freq_inc_notify
 */
__read_mostly int sysctl_sched_freq_inc_notify = 10 * 1024 * 1024; /* + 10GHz */

/*
 * For decrease, send notification if
 *      cur_freq - freq_required > sysctl_sched_freq_dec_notify
 */
__read_mostly int sysctl_sched_freq_dec_notify = 10 * 1024 * 1024; /* - 10GHz */

static __read_mostly unsigned int sched_io_is_busy;

@@ -1266,19 +1275,14 @@ static inline int cpu_is_waiting_on_io(struct rq *rq)
static inline int
nearly_same_freq(unsigned int cur_freq, unsigned int freq_required)
{
	int margin;
	int delta = freq_required - cur_freq;

	margin = cur_freq - freq_required;
	margin *= 100;
	margin /= (int)cur_freq;
	if (freq_required > cur_freq)
		return delta < sysctl_sched_freq_inc_notify;

	/*
	 * + margin implies cur_freq > req_freq
	 * - margin implies cur_freq < req_freq
	 */
	delta = -delta;

	return (margin > sysctl_sched_freq_inc_notify_slack_pct &&
		margin < sysctl_sched_freq_dec_notify_slack_pct);
	return delta < sysctl_sched_freq_dec_notify;
}

/* Is governor late in responding? */
+4 −4
Original line number Diff line number Diff line
@@ -303,15 +303,15 @@ static struct ctl_table kern_table[] = {
	},
#ifdef CONFIG_SCHED_FREQ_INPUT
	{
		.procname	= "sched_freq_inc_notify_slack_pct",
		.data		= &sysctl_sched_freq_inc_notify_slack_pct,
		.procname	= "sched_freq_inc_notify",
		.data		= &sysctl_sched_freq_inc_notify,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "sched_freq_dec_notify_slack_pct",
		.data		= &sysctl_sched_freq_dec_notify_slack_pct,
		.procname	= "sched_freq_dec_notify",
		.data		= &sysctl_sched_freq_dec_notify,
		.maxlen		= sizeof(unsigned int),
		.mode		= 0644,
		.proc_handler	= proc_dointvec,