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

Commit 5b2c9959 authored by Lingutla Chandrasekhar's avatar Lingutla Chandrasekhar Committed by Gerrit - the friendly Code Review server
Browse files

sched: energy: rebuild sched_domains with actual capacities



While sched initialization, sched_domains might have built
with default capacity values, and max_{min_}_cap_org_cpu's
have updated based on them. After energy probe called,
these capacities would change, but max_{min_}cap_org_cpu's
still have old values. And using these staled cpus could give
wrong start_cpu in finding energy efficient cpu.

So rebuild sched_domains, which updates all cpu's group capacities
with actual capacities and then build domains again, and update
max_{min_}cap_org_cpus as well.

Change-Id: I07d58bc849de363c5ed8fb743ab98d3fba727130
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent fc8e63be
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/sched_energy.h>
#include <linux/stddef.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/pm_opp.h>
#include <linux/platform_device.h>

@@ -49,6 +50,17 @@ static void free_resources(void)
	}
}

static int update_topology;

/*
 * Ideally this should be arch specific implementation,
 * let's define here to help rebuild sched_domain with new capacities.
 */
int arch_update_cpu_topology(void)
{
	return update_topology;
}

void init_sched_energy_costs(void)
{
	struct device_node *cn, *cp;
@@ -273,8 +285,22 @@ static int sched_energy_probe(struct platform_device *pdev)

	kfree(max_frequencies);

	if (is_sge_valid)
	if (is_sge_valid) {
		/*
		 * Sched_domains might have built with default cpu capacity
		 * values on bootup.
		 *
		 * Let's rebuild them again with actual cpu capacities.
		 * And partition_sched_domain() expects update in cpu topology
		 * to rebuild the domains, so make it satisfied..
		 */
		update_topology = 1;
		rebuild_sched_domains();
		update_topology = 0;

		walt_sched_energy_populated_callback();
	}

	dev_info(&pdev->dev, "Sched-energy-costs capacity updated\n");
	return 0;