Re: [RFC][PATCH 09/14] sched: Dynamically allocatesched_domain/sched_group data-structures
From: Bharata B Rao
Date: Fri Mar 18 2011 - 05:08:38 EST
On Mon, Mar 14, 2011 at 8:36 PM, Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:
>
> enum s_alloc {
> sa_rootdomain,
> sa_sd,
> - sa_tmpmask,
> + sa_sd_storage,
> sa_send_covered,
> sa_nodemask,
> sa_none,
> };
>
>
>
> SD_INIT_FUNC(CPU)
> @@ -7079,13 +6995,22 @@ static void set_domain_attribute(struct
> static void __free_domain_allocs(struct s_data *d, enum s_alloc what,
> const struct cpumask *cpu_map)
> {
> + int i, j;
> +
> switch (what) {
> case sa_rootdomain:
> - free_rootdomain(d->rd); /* fall through */
> + free_rootdomain(&d->rd->rcu); /* fall through */
> case sa_sd:
> free_percpu(d->sd); /* fall through */
> - case sa_tmpmask:
> - free_cpumask_var(d->tmpmask); /* fall through */
> + case sa_sd_storage:
> + for (i = 0; i < SD_LV_MAX; i++) {
> + for_each_cpu(j, cpu_map) {
> + kfree(*per_cpu_ptr(d->sdd[i].sd, j));
> + kfree(*per_cpu_ptr(d->sdd[i].sg, j));
> + }
> + free_percpu(d->sdd[i].sd);
> + free_percpu(d->sdd[i].sg);
> + } /* fall through */
> case sa_send_covered:
> free_cpumask_var(d->send_covered); /* fall through */
> case sa_nodemask:
> @@ -7098,25 +7023,70 @@ static void __free_domain_allocs(struct
> static enum s_alloc __visit_domain_allocation_hell(struct s_data *d,
> const struct cpumask *cpu_map)
> {
> + int i, j;
> +
> + memset(d, 0, sizeof(*d));
> +
> if (!alloc_cpumask_var(&d->nodemask, GFP_KERNEL))
> return sa_none;
> if (!alloc_cpumask_var(&d->send_covered, GFP_KERNEL))
> return sa_nodemask;
> - if (!alloc_cpumask_var(&d->tmpmask, GFP_KERNEL))
> - return sa_send_covered;
sa_send_covered enum member can be removed, since you no longer seem
to be using it.
Regards,
Bharata.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/