Re: [patch v2 1/2] sched: Use resched IPI to kick off the nohz idlebalance

From: Suresh Siddha
Date: Fri Oct 07 2011 - 20:08:20 EST


On Thu, 2011-10-06 at 10:27 -0700, Vivek Goyal wrote:
> On Mon, Oct 03, 2011 at 03:09:00PM -0700, Suresh Siddha wrote:
> [..]
> >
> > [ This issue is present from 2.6.35+ kernels, but marking it -stable
> > only from v3.0+ as the proposed fix depends on the scheduler_ipi()
> > that is introduced recently. ]
> >
>
> Hi Suresh,
>
> Are you planning to fix this issue for older kernels too? I am wondering
> how to go about fixing it there.
>

Vivek, Initially when Prarit brought this issue to me, I gave an ugly
quick fix (Appended) for a quick try. But I would recommend we back port
the couple of mainline patches that introduced scheduler_ipi() code
along with these two patches. Thoughts?

---
Quick and dirty fix for the deadlock caused by the nohz balance logic.

Signed-off-by: Suresh Siddha <suresh.b.siddha@xxxxxxxxx>
---
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index bc8ee99..f48b950 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -3618,6 +3618,7 @@ static DEFINE_PER_CPU(struct call_single_data, remote_sched_softirq_cb);
static void trigger_sched_softirq(void *data)
{
raise_softirq_irqoff(SCHED_SOFTIRQ);
+ this_rq()->nohz_balance_kick = 2;
}

static inline void init_sched_softirq_csd(struct call_single_data *csd)
@@ -3977,7 +3978,7 @@ static void nohz_idle_balance(int this_cpu, enum cpu_idle_type idle)
struct rq *rq;
int balance_cpu;

- if (idle != CPU_IDLE || !this_rq->nohz_balance_kick)
+ if (idle != CPU_IDLE || (this_rq->nohz_balance_kick != 2))
return;

for_each_cpu(balance_cpu, nohz.idle_cpus_mask) {


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