lkml.org 
[lkml]   [2006]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Patch: dynticks: idle load balancing
On Thu, Dec 14, 2006 at 12:13:16AM +0100, Ingo Molnar wrote:
> there's another bug as well: in schedule() resched_cpu() is called with
> the current runqueue held in two places, which is deadlock potential.

resched_cpu() was getting called after prepare_task_switch() which
releases the current runqueue lock. Isn't it?

> The easiest fix for this is to use trylock - find the patch for that.
> This is a hint only anyway - and if a CPU is idle its runqueue will be

Though I don't see a potential deadlock, I like this optimization.

thanks,
suresh

> lockable. (fixing it via double-locking is easy in the first call site,
> but the second one looks harder)
>
> Ingo
>
> Index: linux/kernel/sched.c
> ===================================================================
> --- linux.orig/kernel/sched.c
> +++ linux/kernel/sched.c
> @@ -1167,12 +1167,14 @@ static void resched_task(struct task_str
> if (!tsk_is_polling(p))
> smp_send_reschedule(cpu);
> }
> +
> static void resched_cpu(int cpu)
> {
> struct rq *rq = cpu_rq(cpu);
> - unsigned int flags;
> + unsigned long flags;
>
> - spin_lock_irqsave(&rq->lock, flags);
> + if (!spin_trylock_irqsave(&rq->lock, flags))
> + return;
> resched_task(cpu_curr(cpu));
> spin_unlock_irqrestore(&rq->lock, flags);
> }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-14 00:43    [W:0.058 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site