linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 2/2] sched: topology: Initialize span_weight from sd_init()
Date: Thu, 27 Apr 2017 13:59:00 +0530	[thread overview]
Message-ID: <be1aa0f6c8c5d4cf9a3c35c7bc48be74f60c84e6.1493281605.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <36e4cbb6210002cadae89920ae97e19e7e513008.1493281605.git.viresh.kumar@linaro.org>
In-Reply-To: <36e4cbb6210002cadae89920ae97e19e7e513008.1493281605.git.viresh.kumar@linaro.org>

Most of the sched domain structure gets initialized from sd_init() and
it looks reasonable to initialize span_weight too from it.

Currently it is getting initialized from build_sched_domains(), which
doesn't looks to be the ideal place for doing so.

With this change we need to additionally reset span_weight for a special
error case, but that looks reasonable as span_weight must be updated
every time domain span is updated.

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

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 09a56ca76bd1..691b290a679e 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -892,6 +892,7 @@ sd_init(struct sched_domain_topology_level *tl,
 
 		.last_balance		= jiffies,
 		.balance_interval	= sd_weight,
+		.span_weight		= sd_weight,
 		.smt_gain		= 0,
 		.max_newidle_lb_cost	= 0,
 		.next_decay_max_lb_cost	= jiffies,
@@ -1373,6 +1374,7 @@ static struct sched_domain *build_sched_domain(struct sched_domain_topology_leve
 			cpumask_or(sched_domain_span(sd),
 				   sched_domain_span(sd),
 				   sched_domain_span(child));
+			sd->span_weight = cpumask_weight(sched_domain_span(sd));
 		}
 
 	}
@@ -1417,7 +1419,6 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
 	/* Build the groups for the domains */
 	for_each_cpu(i, cpu_map) {
 		for (sd = *per_cpu_ptr(d.sd, i); sd; sd = sd->parent) {
-			sd->span_weight = cpumask_weight(sched_domain_span(sd));
 			if (sd->flags & SD_OVERLAP) {
 				if (build_overlap_sched_groups(sd, i))
 					goto error;
-- 
2.12.0.432.g71c3a4f4ba37

  reply	other threads:[~2017-04-27  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-27  8:28 [PATCH 1/2] sched: Staticize pick_next_task_dl() and build_sched_domain() Viresh Kumar
2017-04-27  8:29 ` Viresh Kumar [this message]
2017-08-10 12:06 ` [tip:sched/core] sched: Mark pick_next_task_dl() and build_sched_domain() as static tip-bot for Viresh Kumar

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=be1aa0f6c8c5d4cf9a3c35c7bc48be74f60c84e6.1493281605.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).