Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205894 > unrolled thread
| Started by | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| First post | 2015-08-12 12:20 +0200 |
| Last post | 2015-08-12 19:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures Peter Zijlstra <peterz@infradead.org> - 2015-08-12 12:20 +0200
Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures Dietmar Eggemann <dietmar.eggemann@arm.com> - 2015-08-12 19:20 +0200
Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures Peter Zijlstra <peterz@infradead.org> - 2015-08-12 19:30 +0200
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-08-12 12:20 +0200 |
| Subject | Re: [RFCv5 PATCH 16/46] sched: Allocate and initialize energy data structures |
| Message-ID | <pWBiz-1oV-51@gated-at.bofh.it> |
On Tue, Jul 07, 2015 at 07:23:59PM +0100, Morten Rasmussen wrote:
> @@ -6647,10 +6703,24 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
> if (!sdd->sgc)
> return -ENOMEM;
>
> + sdd->sge = alloc_percpu(struct sched_group_energy *);
> + if (!sdd->sge)
> + return -ENOMEM;
> +
> for_each_cpu(j, cpu_map) {
> struct sched_domain *sd;
> struct sched_group *sg;
> struct sched_group_capacity *sgc;
> + struct sched_group_energy *sge;
> + sched_domain_energy_f fn = tl->energy;
> + unsigned int nr_idle_states = 0;
> + unsigned int nr_cap_states = 0;
> +
> + if (fn && fn(j)) {
> + nr_idle_states = fn(j)->nr_idle_states;
> + nr_cap_states = fn(j)->nr_cap_states;
> + BUG_ON(!nr_idle_states || !nr_cap_states);
> + }
>
> sd = kzalloc_node(sizeof(struct sched_domain) + cpumask_size(),
> GFP_KERNEL, cpu_to_node(j));
> @@ -6674,6 +6744,16 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
> return -ENOMEM;
>
> *per_cpu_ptr(sdd->sgc, j) = sgc;
> +
> + sge = kzalloc_node(sizeof(struct sched_group_energy) +
> + nr_idle_states*sizeof(struct idle_state) +
> + nr_cap_states*sizeof(struct capacity_state),
> + GFP_KERNEL, cpu_to_node(j));
> +
> + if (!sge)
> + return -ENOMEM;
> +
> + *per_cpu_ptr(sdd->sge, j) = sge;
> }
> }
>
One more question, if fn() returns a full structure, why are we
allocating and copying the thing? Its all const read only data, right?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Dietmar Eggemann <dietmar.eggemann@arm.com> |
|---|---|
| Date | 2015-08-12 19:20 +0200 |
| Message-ID | <pWHQZ-2rD-3@gated-at.bofh.it> |
| In reply to | #1205894 |
On 12/08/15 11:17, Peter Zijlstra wrote: > On Tue, Jul 07, 2015 at 07:23:59PM +0100, Morten Rasmussen wrote: >> @@ -6647,10 +6703,24 @@ static int __sdt_alloc(const struct cpumask *cpu_map) [...] >> @@ -6674,6 +6744,16 @@ static int __sdt_alloc(const struct cpumask *cpu_map) >> return -ENOMEM; >> >> *per_cpu_ptr(sdd->sgc, j) = sgc; >> + >> + sge = kzalloc_node(sizeof(struct sched_group_energy) + >> + nr_idle_states*sizeof(struct idle_state) + >> + nr_cap_states*sizeof(struct capacity_state), >> + GFP_KERNEL, cpu_to_node(j)); >> + >> + if (!sge) >> + return -ENOMEM; >> + >> + *per_cpu_ptr(sdd->sge, j) = sge; >> } >> } >> > > One more question, if fn() returns a full structure, why are we > allocating and copying the thing? Its all const read only data, right? > Yeah, that's not strictly necessary. I could get rid of all the allocation/copying/ and freeing code and just simply set sd->groups->sge = fn(cpu) in init_sched_energy(). Plus delete the atomic_t ref in struct sched_group_energy. In this case, should I still keep the check_sched_energy_data() function to verify that the scheduler got valid data via the struct sched_domain_topology_level table from the arch, i.e. to make sure that the per-cpu provided sd energy data is consistent for all cpus within the sched group cpumask? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2015-08-12 19:30 +0200 |
| Message-ID | <pWI0H-2CX-19@gated-at.bofh.it> |
| In reply to | #1206285 |
On Wed, Aug 12, 2015 at 06:09:59PM +0100, Dietmar Eggemann wrote: > > One more question, if fn() returns a full structure, why are we > > allocating and copying the thing? Its all const read only data, right? > > > > Yeah, that's not strictly necessary. I could get rid of all the > allocation/copying/ and freeing code and just simply set sd->groups->sge > = fn(cpu) in init_sched_energy(). Plus delete the atomic_t ref in struct > sched_group_energy. > > In this case, should I still keep the check_sched_energy_data() function > to verify that the scheduler got valid data via the struct > sched_domain_topology_level table from the arch, i.e. to make sure that > the per-cpu provided sd energy data is consistent for all cpus within > the sched group cpumask? Oh yes very much. We want sanity checking of the data handed. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web