All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] sched: Sched Domains: Fixups
@ 2013-06-10 10:57 Viresh Kumar
  2013-06-10 10:57 ` [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains Viresh Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Viresh Kumar @ 2013-06-10 10:57 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

Peter/Ingo,

These are minor fixes that I could find for code responsible for creating sched
domains. They are rebased of my earlier fixes:

https://lkml.org/lkml/2013/6/4/253

I couldn't find them in linux-next or tip/master and so giving this link.

Viresh Kumar (3):
  sched: don't initialize alloc_state in build_sched_domains
  sched: don't sd->child to NULL when it is already NULL
  sched: Create for_each_sd_topology()

 kernel/sched/core.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains
  2013-06-10 10:57 [PATCH 0/3] sched: Sched Domains: Fixups Viresh Kumar
@ 2013-06-10 10:57 ` Viresh Kumar
  2013-06-19 18:40   ` [tip:sched/core] sched: Don' t initialize alloc_state in build_sched_domains() tip-bot for Viresh Kumar
  2013-06-10 10:57 ` [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL Viresh Kumar
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Viresh Kumar @ 2013-06-10 10:57 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

alloc_state will be overwritten by __visit_domain_allocation_hell() and so we
don't actually need to initialize alloc_state.

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

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0623703..5faa748 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5956,7 +5956,7 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
 static int build_sched_domains(const struct cpumask *cpu_map,
 			       struct sched_domain_attr *attr)
 {
-	enum s_alloc alloc_state = sa_none;
+	enum s_alloc alloc_state;
 	struct sched_domain *sd;
 	struct s_data d;
 	int i, ret = -ENOMEM;
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL
  2013-06-10 10:57 [PATCH 0/3] sched: Sched Domains: Fixups Viresh Kumar
  2013-06-10 10:57 ` [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains Viresh Kumar
@ 2013-06-10 10:57 ` Viresh Kumar
  2013-06-10 13:33   ` Viresh Kumar
  2013-06-19 18:40   ` [tip:sched/core] sched: Don't set sd-> child " tip-bot for Viresh Kumar
  2013-06-10 10:57 ` [PATCH 3/3] sched: Create for_each_sd_topology() Viresh Kumar
  2013-06-18 10:00 ` [PATCH 0/3] sched: Sched Domains: Fixups Peter Zijlstra
  3 siblings, 2 replies; 9+ messages in thread
From: Viresh Kumar @ 2013-06-10 10:57 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

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(-)

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;
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] sched: Create for_each_sd_topology()
  2013-06-10 10:57 [PATCH 0/3] sched: Sched Domains: Fixups Viresh Kumar
  2013-06-10 10:57 ` [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains Viresh Kumar
  2013-06-10 10:57 ` [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL Viresh Kumar
@ 2013-06-10 10:57 ` Viresh Kumar
  2013-06-19 18:40   ` [tip:sched/core] " tip-bot for Viresh Kumar
  2013-06-18 10:00 ` [PATCH 0/3] sched: Sched Domains: Fixups Peter Zijlstra
  3 siblings, 1 reply; 9+ messages in thread
From: Viresh Kumar @ 2013-06-10 10:57 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

For loop for traversing sched_domain_topology was used at multiple placed in
core.c. This patch removes code redundancy by creating for_each_sd_topology().

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

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a12113d..e585e10 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5552,6 +5552,9 @@ static struct sched_domain_topology_level default_topology[] = {
 
 static struct sched_domain_topology_level *sched_domain_topology = default_topology;
 
+#define for_each_sd_topology(tl)			\
+	for (tl = sched_domain_topology; tl->init; tl++)
+
 #ifdef CONFIG_NUMA
 
 static int sched_domains_numa_levels;
@@ -5849,7 +5852,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
 	struct sched_domain_topology_level *tl;
 	int j;
 
-	for (tl = sched_domain_topology; tl->init; tl++) {
+	for_each_sd_topology(tl) {
 		struct sd_data *sdd = &tl->data;
 
 		sdd->sd = alloc_percpu(struct sched_domain *);
@@ -5902,7 +5905,7 @@ static void __sdt_free(const struct cpumask *cpu_map)
 	struct sched_domain_topology_level *tl;
 	int j;
 
-	for (tl = sched_domain_topology; tl->init; tl++) {
+	for_each_sd_topology(tl) {
 		struct sd_data *sdd = &tl->data;
 
 		for_each_cpu(j, cpu_map) {
@@ -5970,7 +5973,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,
 		struct sched_domain_topology_level *tl;
 
 		sd = NULL;
-		for (tl = sched_domain_topology; tl->init; tl++) {
+		for_each_sd_topology(tl) {
 			sd = build_sched_domain(tl, cpu_map, attr, sd, i);
 			if (tl == sched_domain_topology)
 				*per_cpu_ptr(d.sd, i) = sd;
-- 
1.7.12.rc2.18.g61b472e


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL
  2013-06-10 10:57 ` [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL Viresh Kumar
@ 2013-06-10 13:33   ` Viresh Kumar
  2013-06-19 18:40   ` [tip:sched/core] sched: Don't set sd-> child " tip-bot for Viresh Kumar
  1 sibling, 0 replies; 9+ messages in thread
From: Viresh Kumar @ 2013-06-10 13:33 UTC (permalink / raw)
  To: mingo, peterz
  Cc: linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan, Viresh Kumar

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] sched: Sched Domains: Fixups
  2013-06-10 10:57 [PATCH 0/3] sched: Sched Domains: Fixups Viresh Kumar
                   ` (2 preceding siblings ...)
  2013-06-10 10:57 ` [PATCH 3/3] sched: Create for_each_sd_topology() Viresh Kumar
@ 2013-06-18 10:00 ` Peter Zijlstra
  3 siblings, 0 replies; 9+ messages in thread
From: Peter Zijlstra @ 2013-06-18 10:00 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: mingo, linaro-kernel, patches, linux-kernel, robin.randhawa,
	Steve.Bannister, Liviu.Dudau, charles.garcia-tobin,
	arvind.chauhan

On Mon, Jun 10, 2013 at 04:27:17PM +0530, Viresh Kumar wrote:
> Peter/Ingo,
> 
> These are minor fixes that I could find for code responsible for creating sched
> domains. They are rebased of my earlier fixes:
> 
> https://lkml.org/lkml/2013/6/4/253
> 
> I couldn't find them in linux-next or tip/master and so giving this link.
> 
> Viresh Kumar (3):
>   sched: don't initialize alloc_state in build_sched_domains
>   sched: don't sd->child to NULL when it is already NULL
>   sched: Create for_each_sd_topology()
> 
>  kernel/sched/core.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [tip:sched/core] sched: Don' t initialize alloc_state in build_sched_domains()
  2013-06-10 10:57 ` [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains Viresh Kumar
@ 2013-06-19 18:40   ` tip-bot for Viresh Kumar
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Viresh Kumar @ 2013-06-19 18:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, viresh.kumar, tglx

Commit-ID:  1c6321694074163b5863c13d71c19ca953a3fb08
Gitweb:     http://git.kernel.org/tip/1c6321694074163b5863c13d71c19ca953a3fb08
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Mon, 10 Jun 2013 16:27:18 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Jun 2013 12:58:44 +0200

sched: Don't initialize alloc_state in build_sched_domains()

alloc_state will be overwritten by __visit_domain_allocation_hell() and so we
don't actually need to initialize alloc_state.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/df57734a075cc5ad130e1ae498702e24f2529ab8.1370861520.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 137dcc0..3de6264 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5969,7 +5969,7 @@ struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
 static int build_sched_domains(const struct cpumask *cpu_map,
 			       struct sched_domain_attr *attr)
 {
-	enum s_alloc alloc_state = sa_none;
+	enum s_alloc alloc_state;
 	struct sched_domain *sd;
 	struct s_data d;
 	int i, ret = -ENOMEM;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:sched/core] sched: Don't set sd-> child to NULL when it is already NULL
  2013-06-10 10:57 ` [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL Viresh Kumar
  2013-06-10 13:33   ` Viresh Kumar
@ 2013-06-19 18:40   ` tip-bot for Viresh Kumar
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Viresh Kumar @ 2013-06-19 18:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, viresh.kumar, tglx

Commit-ID:  c75e01288ce9c9a6b7beb6b23c07d2e4d1db8c84
Gitweb:     http://git.kernel.org/tip/c75e01288ce9c9a6b7beb6b23c07d2e4d1db8c84
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Mon, 10 Jun 2013 16:27:19 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Jun 2013 12:58:45 +0200

sched: Don't set sd->child to NULL when it is already NULL

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>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/f4753a1730051341003ad2ad29a3229c7356678e.1370861520.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3de6264..88c2c0e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5955,8 +5955,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;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [tip:sched/core] sched: Create for_each_sd_topology()
  2013-06-10 10:57 ` [PATCH 3/3] sched: Create for_each_sd_topology() Viresh Kumar
@ 2013-06-19 18:40   ` tip-bot for Viresh Kumar
  0 siblings, 0 replies; 9+ messages in thread
From: tip-bot for Viresh Kumar @ 2013-06-19 18:40 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, viresh.kumar, tglx

Commit-ID:  27723a68caf05381b0b0bc6e127da2c9e7bcb775
Gitweb:     http://git.kernel.org/tip/27723a68caf05381b0b0bc6e127da2c9e7bcb775
Author:     Viresh Kumar <viresh.kumar@linaro.org>
AuthorDate: Mon, 10 Jun 2013 16:27:20 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 19 Jun 2013 12:58:45 +0200

sched: Create for_each_sd_topology()

For loop for traversing sched_domain_topology was used at multiple placed in
core.c. This patch removes code redundancy by creating for_each_sd_topology().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/e0e04542f54e9464bd9da54f5ccfe62ec6c4c0bc.1370861520.git.viresh.kumar@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 88c2c0e..547b7d3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5565,6 +5565,9 @@ static struct sched_domain_topology_level default_topology[] = {
 
 static struct sched_domain_topology_level *sched_domain_topology = default_topology;
 
+#define for_each_sd_topology(tl)			\
+	for (tl = sched_domain_topology; tl->init; tl++)
+
 #ifdef CONFIG_NUMA
 
 static int sched_domains_numa_levels;
@@ -5862,7 +5865,7 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
 	struct sched_domain_topology_level *tl;
 	int j;
 
-	for (tl = sched_domain_topology; tl->init; tl++) {
+	for_each_sd_topology(tl) {
 		struct sd_data *sdd = &tl->data;
 
 		sdd->sd = alloc_percpu(struct sched_domain *);
@@ -5915,7 +5918,7 @@ static void __sdt_free(const struct cpumask *cpu_map)
 	struct sched_domain_topology_level *tl;
 	int j;
 
-	for (tl = sched_domain_topology; tl->init; tl++) {
+	for_each_sd_topology(tl) {
 		struct sd_data *sdd = &tl->data;
 
 		for_each_cpu(j, cpu_map) {
@@ -5983,7 +5986,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,
 		struct sched_domain_topology_level *tl;
 
 		sd = NULL;
-		for (tl = sched_domain_topology; tl->init; tl++) {
+		for_each_sd_topology(tl) {
 			sd = build_sched_domain(tl, cpu_map, attr, sd, i);
 			if (tl == sched_domain_topology)
 				*per_cpu_ptr(d.sd, i) = sd;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-19 18:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-10 10:57 [PATCH 0/3] sched: Sched Domains: Fixups Viresh Kumar
2013-06-10 10:57 ` [PATCH 1/3] sched: don't initialize alloc_state in build_sched_domains Viresh Kumar
2013-06-19 18:40   ` [tip:sched/core] sched: Don' t initialize alloc_state in build_sched_domains() tip-bot for Viresh Kumar
2013-06-10 10:57 ` [PATCH 2/3] sched: don't sd->child to NULL when it is already NULL Viresh Kumar
2013-06-10 13:33   ` Viresh Kumar
2013-06-19 18:40   ` [tip:sched/core] sched: Don't set sd-> child " tip-bot for Viresh Kumar
2013-06-10 10:57 ` [PATCH 3/3] sched: Create for_each_sd_topology() Viresh Kumar
2013-06-19 18:40   ` [tip:sched/core] " tip-bot for Viresh Kumar
2013-06-18 10:00 ` [PATCH 0/3] sched: Sched Domains: Fixups Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.