Re: [tip:sched/urgent] sched: Check sched_domain before computinggroup power

From: Peter Zijlstra
Date: Tue Dec 10 2013 - 05:58:43 EST


On Thu, Dec 05, 2013 at 10:24:25PM -0800, Yinghai Lu wrote:
> ---
> kernel/sched/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> Index: linux-2.6/kernel/sched/core.c
> ===================================================================
> --- linux-2.6.orig/kernel/sched/core.c
> +++ linux-2.6/kernel/sched/core.c
> @@ -5737,6 +5737,9 @@ static int __sdt_alloc(const struct cpum
> if (!sgp)
> return -ENOMEM;
>
> + /* avoid divide-by-zero in sg_capacity() */
> + sgp->power_orig = 1;
> +
> *per_cpu_ptr(sdd->sgp, j) = sgp;
> }
> }


Ooh, sg_capacity() is generating the /0..

Does the below work too?

---
kernel/sched/core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 87c3bc47d99d..40b185f5a3ec 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5115,6 +5115,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu)
* die on a /0 trap.
*/
sg->sgp->power = SCHED_POWER_SCALE * cpumask_weight(sg_span);
+ sg->sgp->power_orig = sg->sgp->power;

/*
* Make sure the first group of this domain contains the
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/