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

Commit 220c8fe0 authored by Rohit Gupta's avatar Rohit Gupta Committed by Jonathan Avila
Browse files

cpufreq: cpu-boost: Force most/all tasks to big cluster on input event



Scheduler provides an API to force tasks to the big cluster. To
improve performance, use this API to move most/all tasks to the
big cluster for short duration on an input event. On the removal of
frequency boost (after input_boost_ms), this scheduler boost is also
deactivated.

Change-Id: I9d643914ebc75266478cc22260a45862faad6236
Signed-off-by: default avatarRohit Gupta <rohgup@codeaurora.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent ad47217c
Loading
Loading
Loading
Loading
+34 −2
Original line number Diff line number Diff line
@@ -54,6 +54,13 @@ show_one(input_boost_ms);
store_one(input_boost_ms);
cpu_boost_attr_rw(input_boost_ms);

static unsigned int sched_boost_on_input;
show_one(sched_boost_on_input);
store_one(sched_boost_on_input);
cpu_boost_attr_rw(sched_boost_on_input);

static bool sched_boost_active;

static struct delayed_work input_boost_rem;
static u64 last_input_time;
#define MIN_INPUT_INTERVAL (150 * USEC_PER_MSEC)
@@ -175,7 +182,7 @@ static void update_policy_online(void)

static void do_input_boost_rem(struct work_struct *work)
{
	unsigned int i;
	unsigned int i, ret;
	struct cpu_sync *i_sync_info;

	/* Reset the input_boost_min for all CPUs in the system */
@@ -187,14 +194,25 @@ static void do_input_boost_rem(struct work_struct *work)

	/* Update policies for all online CPUs */
	update_policy_online();

	if (sched_boost_active) {
		ret = sched_set_boost(0);
		if (ret)
			pr_err("cpu-boost: sched boost disable failed\n");
		sched_boost_active = false;
	}
}

static void do_input_boost(struct work_struct *work)
{
	unsigned int i;
	unsigned int i, ret;
	struct cpu_sync *i_sync_info;

	cancel_delayed_work_sync(&input_boost_rem);
	if (sched_boost_active) {
		sched_set_boost(0);
		sched_boost_active = false;
	}

	/* Set the input_boost_min for all CPUs in the system */
	pr_debug("Setting input boost min for all CPUs\n");
@@ -206,6 +224,15 @@ static void do_input_boost(struct work_struct *work)
	/* Update policies for all online CPUs */
	update_policy_online();

	/* Enable scheduler boost to migrate tasks to big cluster */
	if (sched_boost_on_input) {
		ret = sched_set_boost(1);
		if (ret)
			pr_err("cpu-boost: sched boost enable failed\n");
		else
			sched_boost_active = true;
	}

	queue_delayed_work(cpu_boost_wq, &input_boost_rem,
					msecs_to_jiffies(input_boost_ms));
}
@@ -332,6 +359,11 @@ static int cpu_boost_init(void)
	if (ret)
		pr_err("Failed to create input_boost_freq node: %d\n", ret);

	ret = sysfs_create_file(cpu_boost_kobj,
				&sched_boost_on_input_attr.attr);
	if (ret)
		pr_err("Failed to create sched_boost_on_input node: %d\n", ret);

	ret = input_register_handler(&cpuboost_input_handler);
	return 0;
}