mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups
@ 2014-04-30 13:39 Dietmar Eggemann
  2014-04-30 13:46 ` Dietmar Eggemann
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dietmar Eggemann @ 2014-04-30 13:39 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel, Dietmar Eggemann

From: Dietmar Eggemann <Dietmar.Eggemann@arm.com>

There is no need to zero struct sched_group member cpumask and struct
sched_group_power member power since both structures are already allocated
as zeroed memory in __sdt_alloc().

This patch has been tested with
BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
CPU hotplug scenarios.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
---
 kernel/sched/core.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9cae286824bb..6bc51aebbf1b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5807,8 +5807,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
 			continue;
 
 		group = get_group(i, sdd, &sg);
-		cpumask_clear(sched_group_cpus(sg));
-		sg->sgp->power = 0;
 		cpumask_setall(sched_group_mask(sg));
 
 		for_each_cpu(j, span) {
-- 
1.7.9.5



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

* Re: [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups
  2014-04-30 13:39 [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups Dietmar Eggemann
@ 2014-04-30 13:46 ` Dietmar Eggemann
  2014-05-13  8:32 ` Dietmar Eggemann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Dietmar Eggemann @ 2014-04-30 13:46 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

On 30/04/14 14:39, Dietmar Eggemann wrote:
> From: Dietmar Eggemann <Dietmar.Eggemann@arm.com>
> 
> There is no need to zero struct sched_group member cpumask and struct
> sched_group_power member power since both structures are already allocated
> as zeroed memory in __sdt_alloc().
> 
> This patch has been tested with
> BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
> in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
> CPU hotplug scenarios.
> 
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> ---
>  kernel/sched/core.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 9cae286824bb..6bc51aebbf1b 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5807,8 +5807,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
>  			continue;
>  
>  		group = get_group(i, sdd, &sg);
> -		cpumask_clear(sched_group_cpus(sg));
> -		sg->sgp->power = 0;
>  		cpumask_setall(sched_group_mask(sg));
>  
>  		for_each_cpu(j, span) {
> 

there is also a discrepancy between build_sched_groups() and
build_overlap_sched_groups(). The latter one sets power and power_orig
to SCHED_POWER_SCALE * cpumask_weight(sg_span) (since c3decf0dfbc95
'sched: Always initialize cpu-power' and 8e8339a3a1069 'sched:
Initialize power_orig for overlapping groups').

So we could do the same in build_sched_groups(). IMHO, then the
appropriate check 'if (!group->sgp->power_orig)' in
sched_domain_debug_one() becomes superfluous.

-- Dietmar

Patch proposal against tip_sched_core.

-- >8 --

Subject: [PATCH] sched: Initialize sg->sgp->power and sg->sgp->power_orig for
 non-overlapping groups

---
 kernel/sched/core.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 9cae286824bb..ccf9b811ba37 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5206,18 +5206,6 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
 			break;
 		}
 
-		/*
-		 * Even though we initialize ->power to something semi-sane,
-		 * we leave power_orig unset. This allows us to detect if
-		 * domain iteration is still funny without causing /0 traps.
-		 */
-		if (!group->sgp->power_orig) {
-			printk(KERN_CONT "\n");
-			printk(KERN_ERR "ERROR: domain->cpu_power not "
-					"set\n");
-			break;
-		}
-
 		if (!cpumask_weight(sched_group_cpus(group))) {
 			printk(KERN_CONT "\n");
 			printk(KERN_ERR "ERROR: empty group\n");
@@ -5807,8 +5795,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
 			continue;
 
 		group = get_group(i, sdd, &sg);
-		cpumask_clear(sched_group_cpus(sg));
-		sg->sgp->power = 0;
 		cpumask_setall(sched_group_mask(sg));
 
 		for_each_cpu(j, span) {
@@ -5819,6 +5805,9 @@ build_sched_groups(struct sched_domain *sd, int cpu)
 			cpumask_set_cpu(j, sched_group_cpus(sg));
 		}
 
+		sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sched_group_cpus(sg));
+		sg->sgp->power_orig = sg->sgp->power;
+
 		if (!first)
 			first = sg;
 		if (last)
-- 
1.7.9.5



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

* Re: [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups
  2014-04-30 13:39 [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups Dietmar Eggemann
  2014-04-30 13:46 ` Dietmar Eggemann
@ 2014-05-13  8:32 ` Dietmar Eggemann
  2014-05-13 10:32   ` Peter Zijlstra
  2014-05-19 13:09 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power " tip-bot for Dietmar Eggemann
  2014-05-22 12:27 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power in build_sched_groups() tip-bot for Dietmar Eggemann
  3 siblings, 1 reply; 6+ messages in thread
From: Dietmar Eggemann @ 2014-05-13  8:32 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: linux-kernel

Hi Peter,

On 30/04/14 14:39, Dietmar Eggemann wrote:
> From: Dietmar Eggemann <Dietmar.Eggemann@arm.com>
> 
> There is no need to zero struct sched_group member cpumask and struct
> sched_group_power member power since both structures are already allocated
> as zeroed memory in __sdt_alloc().
> 
> This patch has been tested with
> BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
> in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
> CPU hotplug scenarios.
> 
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> ---
>  kernel/sched/core.c |    2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 9cae286824bb..6bc51aebbf1b 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5807,8 +5807,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
>  			continue;
>  
>  		group = get_group(i, sdd, &sg);
> -		cpumask_clear(sched_group_cpus(sg));
> -		sg->sgp->power = 0;
>  		cpumask_setall(sched_group_mask(sg));
>  
>  		for_each_cpu(j, span) {
> 

I think this one slipped through the cracks. Could you have a look?

Thanks,

-- Dietmar


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

* Re: [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups
  2014-05-13  8:32 ` Dietmar Eggemann
@ 2014-05-13 10:32   ` Peter Zijlstra
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2014-05-13 10:32 UTC (permalink / raw)
  To: Dietmar Eggemann; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1430 bytes --]

On Tue, May 13, 2014 at 09:32:53AM +0100, Dietmar Eggemann wrote:
> Hi Peter,
> 
> On 30/04/14 14:39, Dietmar Eggemann wrote:
> > From: Dietmar Eggemann <Dietmar.Eggemann@arm.com>
> > 
> > There is no need to zero struct sched_group member cpumask and struct
> > sched_group_power member power since both structures are already allocated
> > as zeroed memory in __sdt_alloc().
> > 
> > This patch has been tested with
> > BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
> > in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
> > CPU hotplug scenarios.
> > 
> > Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> > ---
> >  kernel/sched/core.c |    2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 9cae286824bb..6bc51aebbf1b 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -5807,8 +5807,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
> >  			continue;
> >  
> >  		group = get_group(i, sdd, &sg);
> > -		cpumask_clear(sched_group_cpus(sg));
> > -		sg->sgp->power = 0;
> >  		cpumask_setall(sched_group_mask(sg));
> >  
> >  		for_each_cpu(j, span) {
> > 
> 
> I think this one slipped through the cracks. Could you have a look?

Yeah, got stuck in the backlog :/

Seems simple enough, queued it, we'll see if anything explodes ;-)

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

* [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power in build_sched_groups
  2014-04-30 13:39 [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups Dietmar Eggemann
  2014-04-30 13:46 ` Dietmar Eggemann
  2014-05-13  8:32 ` Dietmar Eggemann
@ 2014-05-19 13:09 ` tip-bot for Dietmar Eggemann
  2014-05-22 12:27 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power in build_sched_groups() tip-bot for Dietmar Eggemann
  3 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Dietmar Eggemann @ 2014-05-19 13:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, dietmar.eggemann,
	Dietmar.Eggemann, tglx

Commit-ID:  4d65f453eb2c8f3dd9fc437c9a736c42ddbd50bd
Gitweb:     http://git.kernel.org/tip/4d65f453eb2c8f3dd9fc437c9a736c42ddbd50bd
Author:     Dietmar Eggemann <Dietmar.Eggemann@arm.com>
AuthorDate: Wed, 30 Apr 2014 14:39:38 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 19 May 2014 22:02:41 +0900

sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups

There is no need to zero struct sched_group member cpumask and struct
sched_group_power member power since both structures are already allocated
as zeroed memory in __sdt_alloc().

This patch has been tested with
BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
CPU hotplug scenarios.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1398865178-12577-1-git-send-email-dietmar.eggemann@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/sched/core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ca76cc6..354cd5a 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5794,8 +5794,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
 			continue;
 
 		group = get_group(i, sdd, &sg);
-		cpumask_clear(sched_group_cpus(sg));
-		sg->sgp->power = 0;
 		cpumask_setall(sched_group_mask(sg));
 
 		for_each_cpu(j, span) {

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

* [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power in build_sched_groups()
  2014-04-30 13:39 [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups Dietmar Eggemann
                   ` (2 preceding siblings ...)
  2014-05-19 13:09 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power " tip-bot for Dietmar Eggemann
@ 2014-05-22 12:27 ` tip-bot for Dietmar Eggemann
  3 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Dietmar Eggemann @ 2014-05-22 12:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, peterz, dietmar.eggemann,
	Dietmar.Eggemann, tglx

Commit-ID:  caffcdd8d27ba78730d5540396ce72ad022aff2c
Gitweb:     http://git.kernel.org/tip/caffcdd8d27ba78730d5540396ce72ad022aff2c
Author:     Dietmar Eggemann <Dietmar.Eggemann@arm.com>
AuthorDate: Wed, 30 Apr 2014 14:39:38 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 22 May 2014 11:16:30 +0200

sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups()

There is no need to zero struct sched_group member cpumask and struct
sched_group_power member power since both structures are already allocated
as zeroed memory in __sdt_alloc().

This patch has been tested with
BUG_ON(!cpumask_empty(sched_group_cpus(sg))); and BUG_ON(sg->sgp->power);
in build_sched_groups() on ARM TC2 and INTEL i5 M520 platform including
CPU hotplug scenarios.

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1398865178-12577-1-git-send-email-dietmar.eggemann@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 45d077e..6340c60 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5794,8 +5794,6 @@ build_sched_groups(struct sched_domain *sd, int cpu)
 			continue;
 
 		group = get_group(i, sdd, &sg);
-		cpumask_clear(sched_group_cpus(sg));
-		sg->sgp->power = 0;
 		cpumask_setall(sched_group_mask(sg));
 
 		for_each_cpu(j, span) {

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

end of thread, other threads:[~2014-05-22 12:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 13:39 [PATCH] sched: Do not zero sg->cpumask and sg->sgp->power in build_sched_groups Dietmar Eggemann
2014-04-30 13:46 ` Dietmar Eggemann
2014-05-13  8:32 ` Dietmar Eggemann
2014-05-13 10:32   ` Peter Zijlstra
2014-05-19 13:09 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power " tip-bot for Dietmar Eggemann
2014-05-22 12:27 ` [tip:sched/core] sched: Do not zero sg->cpumask and sg->sgp-> power in build_sched_groups() tip-bot for Dietmar Eggemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome