diff -urN oldtree/fs/proc/base.c newtree/fs/proc/base.c
--- oldtree/fs/proc/base.c	2006-08-18 15:01:22.000000000 -0400
+++ newtree/fs/proc/base.c	2006-08-19 16:51:15.799809750 -0400
@@ -512,10 +512,13 @@
  */
 static int proc_pid_schedstat(struct task_struct *task, char *buffer)
 {
-	return sprintf(buffer, "%lu %lu %lu\n",
+	int ret = sprintf(buffer, "%lu %lu %lu %lu\n",
 			task->sched_info.cpu_time,
 			task->sched_info.run_delay,
+                        task->sched_info.max_delay,
 			task->sched_info.pcnt);
+        task->sched_info.max_delay = 0;
+        return ret;
 }
 #endif
 
diff -urN oldtree/include/linux/sched.h newtree/include/linux/sched.h
--- oldtree/include/linux/sched.h	2006-08-19 09:21:47.000000000 -0400
+++ newtree/include/linux/sched.h	2006-08-19 16:52:08.027073750 -0400
@@ -582,6 +582,7 @@
 	/* cumulative counters */
 	unsigned long	cpu_time,	/* time spent on the cpu */
 			run_delay,	/* time spent waiting on a runqueue */
+                        max_delay,      /* max time spent waiting on a runq */
 			pcnt;		/* # of timeslices run on this cpu */
 
 	/* timestamps */
diff -urN oldtree/kernel/sched_ingosched.c newtree/kernel/sched_ingosched.c
--- oldtree/kernel/sched_ingosched.c	2006-08-19 08:38:17.000000000 -0400
+++ newtree/kernel/sched_ingosched.c	2006-08-19 16:55:10.602484000 -0400
@@ -429,6 +429,7 @@
 		    rq->sched_switch, rq->sched_cnt, rq->sched_goidle,
 		    rq->ttwu_cnt, rq->ttwu_local,
 		    rq->rq_sched_info.cpu_time,
+                    rq->rq_sched_info.max_delay,
 		    rq->rq_sched_info.run_delay, rq->rq_sched_info.pcnt);
 
 		seq_printf(seq, "\n");
@@ -499,6 +500,7 @@
 rq_sched_info_arrive(struct rq *rq, unsigned long delta_jiffies)
 {
 	if (rq) {
+                rq->rq_sched_info.max_delay = max(t->sched_info.max_delay, delta_jiffies);
 		rq->rq_sched_info.run_delay += delta_jiffies;
 		rq->rq_sched_info.pcnt++;
 	}
@@ -574,6 +576,7 @@
 	if (t->sched_info.last_queued)
 		delta_jiffies = now - t->sched_info.last_queued;
 	sched_info_dequeued(t);
+        t->sched_info.max_delay = max(t->sched_info.max_delay, delta_jiffies);
 	t->sched_info.run_delay += delta_jiffies;
 	t->sched_info.last_arrival = now;
 	t->sched_info.pcnt++;
