mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
ANDROID: sched/tune: cleanup schedtune_boostgroup_{init,release}
This update the definition of these two methods to make more clear their role. In this refactored version, the slow path entry functions: schedtune_css_alloc() schedtune_css_free() are in charge just to allocate and release the memory used to track schedtune boost groups. These two functions rely respectively on: schedtune_boostgroup_init() schedtune_boostgroup_release() for everything related to setting up data structures and properly initializing them. Change-Id: I9336102b5c6a6b5726fd466e99b7d6b28d38f455 Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
@@ -632,23 +632,22 @@ static struct cftype files[] = {
|
||||
{ } /* terminate */
|
||||
};
|
||||
|
||||
static int
|
||||
schedtune_boostgroup_init(struct schedtune *st)
|
||||
static void
|
||||
schedtune_boostgroup_init(struct schedtune *st, int idx)
|
||||
{
|
||||
struct boost_groups *bg;
|
||||
int cpu;
|
||||
|
||||
/* Keep track of allocated boost groups */
|
||||
allocated_group[st->idx] = st;
|
||||
|
||||
/* Initialize the per CPU boost groups */
|
||||
/* Initialize per CPUs boost group support */
|
||||
for_each_possible_cpu(cpu) {
|
||||
bg = &per_cpu(cpu_boost_groups, cpu);
|
||||
bg->group[st->idx].boost = 0;
|
||||
bg->group[st->idx].tasks = 0;
|
||||
bg->group[idx].boost = 0;
|
||||
bg->group[idx].tasks = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Keep track of allocated boost groups */
|
||||
allocated_group[idx] = st;
|
||||
st->idx = idx;
|
||||
}
|
||||
|
||||
static struct cgroup_subsys_state *
|
||||
@@ -681,14 +680,10 @@ schedtune_css_alloc(struct cgroup_subsys_state *parent_css)
|
||||
goto out;
|
||||
|
||||
/* Initialize per CPUs boost group support */
|
||||
st->idx = idx;
|
||||
if (schedtune_boostgroup_init(st))
|
||||
goto release;
|
||||
schedtune_boostgroup_init(st, idx);
|
||||
|
||||
return &st->css;
|
||||
|
||||
release:
|
||||
kfree(st);
|
||||
out:
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
@@ -696,8 +691,14 @@ out:
|
||||
static void
|
||||
schedtune_boostgroup_release(struct schedtune *st)
|
||||
{
|
||||
/* Reset this boost group */
|
||||
schedtune_boostgroup_update(st->idx, 0);
|
||||
struct boost_groups *bg;
|
||||
int cpu;
|
||||
|
||||
/* Reset per CPUs boost group support */
|
||||
for_each_possible_cpu(cpu) {
|
||||
bg = &per_cpu(cpu_boost_groups, cpu);
|
||||
bg->group[st->idx].boost = 0;
|
||||
}
|
||||
|
||||
/* Keep track of allocated boost groups */
|
||||
allocated_group[st->idx] = NULL;
|
||||
@@ -708,6 +709,7 @@ schedtune_css_free(struct cgroup_subsys_state *css)
|
||||
{
|
||||
struct schedtune *st = css_st(css);
|
||||
|
||||
/* Release per CPUs boost group support */
|
||||
schedtune_boostgroup_release(st);
|
||||
kfree(st);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user