Re: [PATCH 2.6.16-mm2 4/4] sched_domain: Allocate sched_group structures dynamically
From: Siddha, Suresh B
Date: Sun Apr 02 2006 - 03:55:32 EST
On Sun, Apr 02, 2006 at 11:39:30AM +1000, Nick Piggin wrote:
>
> Srivatsa Vaddagiri wrote:
> > /*
> > @@ -6113,6 +6125,10 @@ next_sg:
> > static int build_sched_domains(const cpumask_t *cpu_map)
> > {
> > int i;
> > + struct sched_group *sched_group_phys = NULL;
> > +#ifdef CONFIG_SCHED_MC
> > + struct sched_group *sched_group_core = NULL;
> > +#endif
> > #ifdef CONFIG_NUMA
> > struct sched_group **sched_group_nodes = NULL;
> > struct sched_group *sched_group_allnodes = NULL;
> > @@ -6171,6 +6187,18 @@ static int build_sched_domains(const cpu
> > cpus_and(sd->span, sd->span, *cpu_map);
> > #endif
> >
> > + if (!sched_group_phys) {
> > + sched_group_phys
> > + = kmalloc(sizeof(struct sched_group) * NR_CPUS,
> > + GFP_KERNEL);
> > + if (!sched_group_phys) {
> > + printk (KERN_WARNING "Can not alloc phys sched"
> > + "group\n");
> > + goto error;
> > + }
> > + sched_group_phys_bycpu[i] = sched_group_phys;
> > + }
>
> Doesn't the last assignment have to be outside the if statement?
>
> Hmm.. this design seems like the best way to go for now. Suresh?
Only thing I see in this is, even if there are very few cpus in the
exclusive cpuset, we end up allocating NR_CPUS groups and waste memory.
thanks,
suresh
-
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/