sched/tune: use a single initialisation function
With the introduction of initialization function required to compute the energy normalization constants from DTB at boot time, we have now a late_initcall which is already used by SchedTune. This patch consolidate within that function the other initialization bits which was previously deferred to the first CGroup creation. Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com> [jstultz: fwdported to 4.4] Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
parent
274bbcfbe4
commit
7f8f24a0ea
1 changed files with 26 additions and 24 deletions
|
@ -410,8 +410,6 @@ boost_write(struct cgroup_subsys_state *css, struct cftype *cft,
|
||||||
s64 boost)
|
s64 boost)
|
||||||
{
|
{
|
||||||
struct schedtune *st = css_st(css);
|
struct schedtune *st = css_st(css);
|
||||||
unsigned threshold_idx;
|
|
||||||
int boost_pct;
|
|
||||||
|
|
||||||
if (boost < -100 || boost > 100)
|
if (boost < -100 || boost > 100)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -456,33 +454,14 @@ schedtune_boostgroup_init(struct schedtune *st)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
schedtune_init(void)
|
|
||||||
{
|
|
||||||
struct boost_groups *bg;
|
|
||||||
int cpu;
|
|
||||||
|
|
||||||
/* Initialize the per CPU boost groups */
|
|
||||||
for_each_possible_cpu(cpu) {
|
|
||||||
bg = &per_cpu(cpu_boost_groups, cpu);
|
|
||||||
memset(bg, 0, sizeof(struct boost_groups));
|
|
||||||
}
|
|
||||||
|
|
||||||
pr_info(" schedtune configured to support %d boost groups\n",
|
|
||||||
BOOSTGROUPS_COUNT);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct cgroup_subsys_state *
|
static struct cgroup_subsys_state *
|
||||||
schedtune_css_alloc(struct cgroup_subsys_state *parent_css)
|
schedtune_css_alloc(struct cgroup_subsys_state *parent_css)
|
||||||
{
|
{
|
||||||
struct schedtune *st;
|
struct schedtune *st;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
if (!parent_css) {
|
if (!parent_css)
|
||||||
schedtune_init();
|
|
||||||
return &root_schedtune.css;
|
return &root_schedtune.css;
|
||||||
}
|
|
||||||
|
|
||||||
/* Allow only single level hierachies */
|
/* Allow only single level hierachies */
|
||||||
if (parent_css != &root_schedtune.css) {
|
if (parent_css != &root_schedtune.css) {
|
||||||
|
@ -543,6 +522,22 @@ struct cgroup_subsys schedtune_cgrp_subsys = {
|
||||||
.early_init = 1,
|
.early_init = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
schedtune_init_cgroups(void)
|
||||||
|
{
|
||||||
|
struct boost_groups *bg;
|
||||||
|
int cpu;
|
||||||
|
|
||||||
|
/* Initialize the per CPU boost groups */
|
||||||
|
for_each_possible_cpu(cpu) {
|
||||||
|
bg = &per_cpu(cpu_boost_groups, cpu);
|
||||||
|
memset(bg, 0, sizeof(struct boost_groups));
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_info("schedtune: configured to support %d boost groups\n",
|
||||||
|
BOOSTGROUPS_COUNT);
|
||||||
|
}
|
||||||
|
|
||||||
#else /* CONFIG_CGROUP_SCHEDTUNE */
|
#else /* CONFIG_CGROUP_SCHEDTUNE */
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -690,7 +685,7 @@ schedtune_add_cluster_nrg(
|
||||||
* that bind the EM to the topology information.
|
* that bind the EM to the topology information.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
schedtune_init_late(void)
|
schedtune_init(void)
|
||||||
{
|
{
|
||||||
struct target_nrg *ste = &schedtune_target_nrg;
|
struct target_nrg *ste = &schedtune_target_nrg;
|
||||||
unsigned long delta_pwr = 0;
|
unsigned long delta_pwr = 0;
|
||||||
|
@ -730,10 +725,17 @@ schedtune_init_late(void)
|
||||||
ste->rdiv.m, ste->rdiv.sh1, ste->rdiv.sh2);
|
ste->rdiv.m, ste->rdiv.sh1, ste->rdiv.sh2);
|
||||||
|
|
||||||
schedtune_test_nrg(delta_pwr);
|
schedtune_test_nrg(delta_pwr);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CGROUP_SCHEDTUNE
|
||||||
|
schedtune_init_cgroups();
|
||||||
|
#else
|
||||||
|
pr_info("schedtune: configured to support global boosting only\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
nodata:
|
nodata:
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
late_initcall(schedtune_init_late);
|
late_initcall(schedtune_init);
|
||||||
|
|
Loading…
Add table
Reference in a new issue