mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liguang <lig.fnst@cn.fujitsu.com>
To: mingo@redhat.com, peterz@infradead.org, Morten.Rasmussen@arm.com,
	linux-kernel@vger.kernel.org
Cc: liguang <lig.fnst@cn.fujitsu.com>
Subject: [PATCH] sched: reduce sched_domain_topology space
Date: Tue, 15 Jan 2013 17:15:18 +0800	[thread overview]
Message-ID: <1358241318-20168-1-git-send-email-lig.fnst@cn.fujitsu.com> (raw)

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


             reply	other threads:[~2013-01-15  9:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15  9:15 liguang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358241318-20168-1-git-send-email-lig.fnst@cn.fujitsu.com \
    --to=lig.fnst@cn.fujitsu.com \
    --cc=Morten.Rasmussen@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®