diff mbox

[2/3] sched: don't sd->child to NULL when it is already NULL

Message ID f4753a1730051341003ad2ad29a3229c7356678e.1370861520.git.viresh.kumar@linaro.org
State Accepted
Headers show

Commit Message

Viresh Kumar June 10, 2013, 10:57 a.m. UTC
Memory for sd is allocated with kzalloc_node() which will initialize its fields
with zero. In build_sched_domain() we are setting sd->child to child even if
child is NULL, which isn't required.

Lets do it only if child isn't NULL.

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

Comments

Viresh Kumar June 10, 2013, 1:33 p.m. UTC | #1
On 10 June 2013 16:27, Viresh Kumar <viresh.kumar@linaro.org> wrote:

Yes subject should be: sched: don't set sd->child to NULL when it is
already NULL
diff mbox

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5faa748..a12113d 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5942,8 +5942,8 @@  struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
 		sd->level = child->level + 1;
 		sched_domain_level_max = max(sched_domain_level_max, sd->level);
 		child->parent = sd;
+		sd->child = child;
 	}
-	sd->child = child;
 	set_domain_attribute(sd, attr);
 
 	return sd;