Re: [PATCH] scheduler: domain: correctly initialize 'next_balance'in 'nohz' idle balancer

From: Peter Zijlstra
Date: Thu Mar 08 2012 - 05:39:55 EST


On Wed, 2012-03-07 at 14:44 -0800, Diwakar Tundlam wrote:
> scheduler: domain: init next_balance in nohz_idle_balancer with jiffies

That's already in the subject, no need to repeat that in the body.

> The 'next_balance' field of 'nohz' idle balancer must be initialized
> to jiffies. Since jiffies is initialized to negative 300 seconds the
> 'nohz' idle balancer does not run for the first 300s (5mins) after
> bootup. If no new processes are spawed or no idle cycles happen, the
> load on the cpus will remain unbalanced for that duration.
>
> Signed-off-by: Diwakar Tundlam <dtundlam@xxxxxxxxxx>
> ---
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff -up sched/fair.c{.orig,}
> --- sched/fair.c.orig 2012-03-07 08:33:03.000000000 -0800
> +++ sched/fair.c 2012-03-07 13:50:30.787265795 -0800

This doesn't work, patches should apply with -p1. I just read
Documentation/SubmittingPatches and I must admit to that not being very
clear.

In any case, I can recommend to using quilt or git to create patches.

I've hand edited the patch for now, but in future please learn to use
either of these tools.

Final patch for re{f,v}erence.. :-)
---
Subject: scheduler: domain: correctly initialize 'next_balance' in 'nohz' idle balancer
From: Diwakar Tundlam <dtundlam@xxxxxxxxxx>
Date: Wed, 7 Mar 2012 14:44:26 -0800

The 'next_balance' field of 'nohz' idle balancer must be initialized
to jiffies. Since jiffies is initialized to negative 300 seconds the
'nohz' idle balancer does not run for the first 300s (5mins) after
bootup. If no new processes are spawed or no idle cycles happen, the
load on the cpus will remain unbalanced for that duration.

Signed-off-by: Diwakar Tundlam <dtundlam@xxxxxxxxxx>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Link: http://lkml.kernel.org/r/1DD7BFEDD3147247B1355BEFEFE4665237994F30EF@xxxxxxxxxxxxxxxxxxx
---
kernel/sched/fair.c | 1 +
1 file changed, 1 insertion(+)

--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5603,6 +5603,7 @@ __init void init_sched_fair_class(void)
open_softirq(SCHED_SOFTIRQ, run_rebalance_domains);

#ifdef CONFIG_NO_HZ
+ nohz.next_balance = jiffies;
zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
cpu_notifier(sched_ilb_notifier, 0);
#endif

--
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/