Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622842

[PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain()

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain()
Date Thu, 13 Apr 2017 11:20:03 +0200
Message-ID <tvJ51-Rx-21@gated-at.bofh.it> (permalink)
References <tvJ50-Rx-9@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=XKRF0py5SmsvtuZJ4DRcI0pxZnzIrsWcnrKWB6NCqe4=; b=QO4lqifOSIVOd0FvTajVLHU+95g+6Mg0bco5FNSbkfGZ3IgAqZldD/ZMa2TuHu/FQR ecTZB3OVDH54eOkxwRdWXshfwXM4vBOFkl3eYHdsDxszsB3ZuBzxpQ/O69duvSCT/HxV ewewS2ZRMyjWkpXsx1cXxMwxNCkbmOnQXnl6g=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=XKRF0py5SmsvtuZJ4DRcI0pxZnzIrsWcnrKWB6NCqe4=; b=jdN+H5B9u3+eN1H0Ko6Zg5tTvdEYcBPgQjD9882BlOn3AyD5lWLDfvoBQ193zQUglj ulIp0GFuBYEYEtpUVTkeu/Sep8cCY5yU8Fdg2lTfAaemrlkDOINOzcZNZwQ4ovK73lam KBKqTAacxrbWWdSfjt0pxg1fpdL3v7aXmxuolupT0lu8ksdEW4+EK9DTQQXwOra/FeY8 qYl2Am2sfc0f3JLojeG9qAwfzHcWzUfcw45iNQkHfQY00ILyvfu4gq2cY4pzDtexbgO2 6vZXrKuozE0a1ycMvBE7TZueCbo7fluRkni/w0RtUNSjXXUQA7mD0WJMqK96n67Vti5r GpHQ==
X-Gm-Message-State AN3rC/4aKmDV1WDZeopDhz+k8pwCAwzBC0oJmjUmAXexEofuigGBRp9B dMifdz17Y7DozTeHVUFddg==
X-Received by 10.84.224.73 with SMTP id a9mr2957660plt.38.1492075012616; Thu, 13 Apr 2017 02:16:52 -0700 (PDT)
X-Mailer git-send-email 2.12.0.432.g71c3a4f4ba37
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 38
Organization linux.* mail to news gateway
X-Original-Cc linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Vincent Guittot <vincent.guittot@linaro.org>, Viresh Kumar <viresh.kumar@linaro.org>
X-Original-Date Thu, 13 Apr 2017 14:45:48 +0530
X-Original-Message-ID <fc2f6cc90b098040970c85a97046512572d765bc.1492065513.git.viresh.kumar@linaro.org>
X-Original-References <cover.1492065513.git.viresh.kumar@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1622842

Show key headers only | View raw


There are only two callers of init_rootdomain(). One of them passes a
global to it and another one sends dynamically allocated root-domain.

There is no need to memset the root-domain in the first case as the
structure is already reset.

Update alloc_rootdomain() to allocate the memory with kzalloc() and
remove the memset() call from init_rootdomain().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/topology.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 1b0b4fb12837..a2497702e628 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -242,8 +242,6 @@ void rq_attach_root(struct rq *rq, struct root_domain *rd)
 
 static int init_rootdomain(struct root_domain *rd)
 {
-	memset(rd, 0, sizeof(*rd));
-
 	if (!zalloc_cpumask_var(&rd->span, GFP_KERNEL))
 		goto out;
 	if (!zalloc_cpumask_var(&rd->online, GFP_KERNEL))
@@ -292,7 +290,7 @@ static struct root_domain *alloc_rootdomain(void)
 {
 	struct root_domain *rd;
 
-	rd = kmalloc(sizeof(*rd), GFP_KERNEL);
+	rd = kzalloc(sizeof(*rd), GFP_KERNEL);
 	if (!rd)
 		return NULL;
 
-- 
2.12.0.432.g71c3a4f4ba37

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 0/3] sched: Minor cleanups Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-13 11:20 +0200
  [PATCH V2 1/3] sched: topology: drop memset() from init_rootdomain() Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-13 11:20 +0200
  [PATCH V2 2/3] sched: cpudeadline: don't re-initialize struct cpudl Viresh Kumar <viresh.kumar@linaro.org> - 2017-04-13 11:20 +0200

csiph-web