Index: generic/src/proc/scheduler.c
===================================================================
--- generic/src/proc/scheduler.c	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ generic/src/proc/scheduler.c	(revision 515854917f1f69363029e17a61330d8adba4ac06)
@@ -134,20 +134,8 @@
 	
 	if (n == 0) {
-		#ifdef CONFIG_SMP
-		/*
-		 * If the load balancing thread is not running, wake it up and
-		 * set CPU-private flag that the kcpulb has been started.
-		 */
-		if (test_and_set(&CPU->kcpulbstarted) == 0) {
-			waitq_wakeup(&CPU->kcpulb_wq, 0);
-			goto loop;
-		}
-		#endif /* CONFIG_SMP */
-		
 		/*
 		 * For there was nothing to run, the CPU goes to sleep
 		 * until a hardware interrupt or an IPI comes.
 		 * This improves energy saving and hyperthreading.
-		 * On the other hand, several hardware interrupts can be ignored.
 		 */
 		 cpu_sleep();
@@ -482,7 +470,7 @@
 loop:
 	/*
-	 * Sleep until there's some work to do.
+	 * Work in 1s intervals.
 	 */
-	waitq_sleep(&CPU->kcpulb_wq);
+	thread_sleep(1);
 
 not_satisfied:
@@ -579,5 +567,5 @@
 				spinlock_lock(&t->lock);
 				#ifdef KCPULB_VERBOSE
-				printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, CPU->nrdy, nrdy / config.cpu_active);
+				printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, CPU->nrdy, atomic_get(&nrdy) / config.cpu_active);
 				#endif
 				t->flags |= X_STOLEN;
@@ -607,11 +595,10 @@
 		 */
 		scheduler();
-	} 
-	else {
+	} else {
 		/*
 		 * We failed to migrate a single thread.
-		 * Something more sophisticated should be done.
+		 * Give up this turn.
 		 */
-		scheduler();
+		goto loop;
 	}
 		
@@ -619,8 +606,4 @@
 
 satisfied:
-	/*
-	 * Tell find_best_thread() to wake us up later again.
-	 */
-	atomic_set(&CPU->kcpulbstarted,0);
 	goto loop;
 }
@@ -656,5 +639,5 @@
 				continue;
 			}
-			printf("Rq %d: ", i);
+			printf("\tRq %d: ", i);
 			for (cur=r->rq_head.next; cur!=&r->rq_head; cur=cur->next) {
 				t = list_get_instance(cur, thread_t, rq_link);
