Dump all sorts of data, instead of BUGging out.
[linux-2.6.git] / linux-2.6-630-sched-fix.patch
1 diff -Nurp linux-2.6.22-620/kernel/sched.c linux-2.6.22-630/kernel/sched.c
2 --- linux-2.6.22-620/kernel/sched.c     2008-06-23 17:20:25.000000000 -0400
3 +++ linux-2.6.22-630/kernel/sched.c     2008-06-23 18:08:14.000000000 -0400
4 @@ -3635,6 +3635,10 @@ struct event_spec {
5  };
6  #endif
7  
8 +/* Bypass the vx_unhold infinite loop */
9 +unsigned int merry;
10 +EXPORT_SYMBOL(merry);
11 +
12  asmlinkage void __sched schedule(void)
13  {
14         struct task_struct *prev, *next;
15 @@ -3722,14 +3726,40 @@ need_resched_nonpreemptible:
16  
17         cpu = smp_processor_id();
18         vx_set_rq_time(rq, jiffies);
19 +
20 +       merry=0;
21  try_unhold:
22         vx_try_unhold(rq, cpu);
23  pick_next:
24  
25         if (unlikely(!rq->nr_running)) {
26                 /* can we skip idle time? */
27 -               if (vx_try_skip(rq, cpu))
28 +               if (vx_try_skip(rq, cpu) && merry<10) {
29 +                       merry++;
30                         goto try_unhold;
31 +               }
32 +               else if (merry==10) {
33 +                       printk(KERN_EMERG "merry==10!\n");
34 +                       if (list_empty(&rq->hold_queue))
35 +                               printk(KERN_EMERG "hold queue is empty\n");
36 +                       else {
37 +                               struct list_head *l, *n;
38 +                               printk(KERN_EMERG "rq->norm_time = %lu, rq->idle_time = %lu\n", rq->norm_time, rq->idle_time);
39 +                               list_for_each_safe(l, n, &rq->hold_queue) {
40 +                                       struct task_struct *p;
41 +                                       struct _vx_sched_pc *sched_pc;
42 +                                       struct vx_info *vxi;
43 +
44 +                                       p = list_entry(l, struct task_struct, run_list);
45 +                                       vxi = p->vx_info;
46 +                                       sched_pc = &vx_per_cpu(vxi, sched_pc, cpu);
47 +
48 +                                       printk(KERN_EMERG "%u: sched_pc->norm_time = %lu, sched_pc->idle_time = %lu\n", vxi->vx_id,
49 +                                               sched_pc->norm_time, sched_pc->idle_time);
50 +                               }
51 +                       }
52 +               }
53 +
54  
55                 idle_balance(cpu, rq);
56                 if (!rq->nr_running) {