--- ./kernel/fairsched.c.fschasrt	Mon Apr 24 12:42:59 2006
+++ ./kernel/fairsched.c	Fri Jun  2 14:59:30 2006
@@ -26,6 +26,7 @@
 #include <linux/sysctl.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/console.h>
 #include <linux/fairsched.h>
 #include <linux/vsched.h>
 
@@ -112,6 +113,8 @@ static inline fschtag_t FSCHTAG_SUB(fsch
 	return (fschtag_t){x.t - y.t};
 }
 
+#define FSCHVALUE_FMT "%Lu"
+#define FSCHVALUE_PRINT(x) ((x).v)
 #define FSCHVALUE_ZERO ((fschvalue_t){0})
 #define TICK_VALUE ((fschvalue_t){(cycles_t)cycles_per_jiffy << FSCHRATE_SHIFT})
 static inline fschvalue_t FSCHVALUE(unsigned long t)
@@ -152,11 +155,34 @@ static inline cycles_t FSCHVALUE_TO_DELA
  */
 /*********************************************************************/
 
+/*
+ * Assertions.
+ * Called with preemption disabled.
+ */
+
 #define fsch_assert(x)							\
 	do {								\
 		static int count;					\
-		if (!(x) && count++ < 10)				\
-			printk("fsch_assert " #x " failed\n");		\
+		if (x)							\
+			break;						\
+		if (count++ < 10)					\
+			break;						\
+		__printk_no_wake++;					\
+		printk("fsch_assert " #x " failed\n");			\
+		__printk_no_wake--;					\
+	} while (0)
+
+#define fsch_validate(x, fmt...)					\
+	do {								\
+		static int count;					\
+		if (x)							\
+			break;						\
+		if (count++ < 10)					\
+			break;						\
+		__printk_no_wake++;					\
+		printk("fsch_assert " #x " failed\n");			\
+		printk("fsch_assert: " fmt);				\
+		__printk_no_wake--;					\
 	} while (0)
 
 /*
@@ -335,7 +361,15 @@ static void fairsched_ratelimit_charge_a
 		cycles_t time)
 {
 	fsch_assert(!node->delayed);
-	fsch_assert(FSCHVALUE_CMP(node->value, TICK_VALUE) >= 0);
+	fsch_validate(FSCHVALUE_CMP(node->value, TICK_VALUE) >= 0,
+			"charge, value " FSCHVALUE_FMT
+			", tick " FSCHVALUE_FMT
+			", delay %Lu, time %Lu"
+			", lastupd %Lu, rate %u\n",
+			FSCHVALUE_PRINT(node->value),
+			FSCHVALUE_PRINT(TICK_VALUE),
+			node->delay, time,
+			node->last_updated_at, node->rate);
 
 	/*
 	 * Account for the time passed since last update.
@@ -422,7 +456,15 @@ static void fairsched_delayed_wake(cycle
 			p->last_updated_at = time;
 		}
 
-		fsch_assert(FSCHVALUE_CMP(p->value, TICK_VALUE) >= 0);
+		fsch_validate(FSCHVALUE_CMP(p->value, TICK_VALUE) >= 0,
+				"wake, value " FSCHVALUE_FMT
+				", tick " FSCHVALUE_FMT
+				", delay %Lu, time %Lu"
+				", lastupd %Lu, rate %u\n",
+				FSCHVALUE_PRINT(p->value),
+				FSCHVALUE_PRINT(TICK_VALUE),
+				p->delay, time,
+				p->last_updated_at, p->rate);
 		p->nr_ready = p->nr_runnable;
 		p->delayed = 0;
 		list_del_init(&p->runlist);
