* [PATCH] sched: reduce sched_domain_topology space
@ 2013-01-15 9:15 liguang
2013-01-16 1:51 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: liguang @ 2013-01-15 9:15 UTC (permalink / raw)
To: mingo, peterz, Morten.Rasmussen, linux-kernel; +Cc: liguang
sched_domain_topology space was allocated by the size
ARRAY_SIZE(default_topology) + sched_domains_numa_levels,
suppose CONFIG_SCHED_SMT, CONFIG_SCHED_MC were y,
"static struct sched_domain_topology_level default_topology[] = {
{ sd_init_SIBLING, cpu_smt_mask, },
{ sd_init_MC, cpu_coregroup_mask, },
{ sd_init_CPU, cpu_cpu_mask, },
{ NULL, },
};"
then, ARRAY_SIZE(default_topology) equals to 4,
default_topology's NULL entry was accounted,
but, the following allocation for other sched_domains_numa_levels
entries was startd at 3(for default_topology[3].init is NULL),
so, 1 entry was forgot.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
kernel/sched/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 257002c..6ba5ecf 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6241,7 +6241,7 @@ static void sched_init_numa(void)
}
}
- tl = kzalloc((ARRAY_SIZE(default_topology) + level) *
+ tl = kzalloc((ARRAY_SIZE(default_topology) + level - 1) *
sizeof(struct sched_domain_topology_level), GFP_KERNEL);
if (!tl)
return;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] sched: reduce sched_domain_topology space
2013-01-15 9:15 [PATCH] sched: reduce sched_domain_topology space liguang
@ 2013-01-16 1:51 ` Namhyung Kim
2013-01-16 2:09 ` li guang
0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2013-01-16 1:51 UTC (permalink / raw)
To: liguang; +Cc: mingo, peterz, Morten.Rasmussen, linux-kernel
Hi, liguang
On Tue, 15 Jan 2013 17:15:18 +0800, liguang wrote:
> sched_domain_topology space was allocated by the size
> ARRAY_SIZE(default_topology) + sched_domains_numa_levels,
> suppose CONFIG_SCHED_SMT, CONFIG_SCHED_MC were y,
> "static struct sched_domain_topology_level default_topology[] = {
> { sd_init_SIBLING, cpu_smt_mask, },
> { sd_init_MC, cpu_coregroup_mask, },
> { sd_init_CPU, cpu_cpu_mask, },
> { NULL, },
> };"
> then, ARRAY_SIZE(default_topology) equals to 4,
> default_topology's NULL entry was accounted,
> but, the following allocation for other sched_domains_numa_levels
> entries was startd at 3(for default_topology[3].init is NULL),
> so, 1 entry was forgot.
I don't think it's forgotten.
The sched_domain_topology still needs NULL entry at the end. So what
the current code does is to set up following sched_domain_topology:
{ default_topology (without last NULL entry), numa topology, NULL }
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] sched: reduce sched_domain_topology space
2013-01-16 1:51 ` Namhyung Kim
@ 2013-01-16 2:09 ` li guang
0 siblings, 0 replies; 4+ messages in thread
From: li guang @ 2013-01-16 2:09 UTC (permalink / raw)
To: Namhyung Kim; +Cc: mingo, peterz, Morten.Rasmussen, linux-kernel
在 2013-01-16三的 10:51 +0900,Namhyung Kim写道:
> Hi, liguang
>
> On Tue, 15 Jan 2013 17:15:18 +0800, liguang wrote:
> > sched_domain_topology space was allocated by the size
> > ARRAY_SIZE(default_topology) + sched_domains_numa_levels,
> > suppose CONFIG_SCHED_SMT, CONFIG_SCHED_MC were y,
> > "static struct sched_domain_topology_level default_topology[] = {
> > { sd_init_SIBLING, cpu_smt_mask, },
> > { sd_init_MC, cpu_coregroup_mask, },
> > { sd_init_CPU, cpu_cpu_mask, },
> > { NULL, },
> > };"
> > then, ARRAY_SIZE(default_topology) equals to 4,
> > default_topology's NULL entry was accounted,
> > but, the following allocation for other sched_domains_numa_levels
> > entries was startd at 3(for default_topology[3].init is NULL),
> > so, 1 entry was forgot.
>
> I don't think it's forgotten.
>
> The sched_domain_topology still needs NULL entry at the end. So what
> the current code does is to set up following sched_domain_topology:
>
> { default_topology (without last NULL entry), numa topology, NULL }
>
> Thanks,
> Namhyung
Oh, that's a trick!
Thanks!
--
regards!
li guang
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] sched: reduce sched_domain_topology space
@ 2013-01-15 9:06 liguang
0 siblings, 0 replies; 4+ messages in thread
From: liguang @ 2013-01-15 9:06 UTC (permalink / raw)
To: mingo, peterz, Morten.Rasmussen, linux-kernel; +Cc: liguang
sched_domain_topology space was allocated by the size
ARRAY_SIZE(default_topology) + sched_domains_numa_levels,
suppose CONFIG_SCHED_SMT, CONFIG_SCHED_MC were y,
"static struct sched_domain_topology_level default_topology[] = {
{ sd_init_SIBLING, cpu_smt_mask, },
{ sd_init_MC, cpu_coregroup_mask, },
{ sd_init_CPU, cpu_cpu_mask, },
{ NULL, },
};"
then, ARRAY_SIZE(default_topology) equals to 4,
default_topology's NULL entry was accounted,
but, the following allocation for other sched_domains_numa_levels
entries was startd at 3(for default_topology[3].init is NULL),
so, 1 entry was forgot.
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
kernel/sched/core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 257002c..83f947e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6241,7 +6241,7 @@ static void sched_init_numa(void)
}
}
- tl = kzalloc((ARRAY_SIZE(default_topology) + level) *
+ tl = kzalloc((ARRAY_SIZE(default_topology) + level - 1 ) *
sizeof(struct sched_domain_topology_level), GFP_KERNEL);
if (!tl)
return;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-16 2:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 9:15 [PATCH] sched: reduce sched_domain_topology space liguang
2013-01-16 1:51 ` Namhyung Kim
2013-01-16 2:09 ` li guang
-- strict thread matches above, loose matches on Subject: below --
2013-01-15 9:06 liguang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox