Index: kernel/test/smpcall/smpcall1.c
===================================================================
--- kernel/test/smpcall/smpcall1.c	(revision 1f8c11fb8cdd200759b495ae526cf6d894d543f0)
+++ kernel/test/smpcall/smpcall1.c	(revision 518dd43efcb2bc45690e83a1c9fed2130e46557b)
@@ -14,8 +14,8 @@
 /* 
  * Maximum total number of smp_calls in the system is: 
- *  128000 == 8^2 * 1000 * 2 
+ *  162000 == 9^2 * 1000 * 2 
  *  == MAX_CPUS^2 * ITERATIONS * EACH_CPU_INC_PER_ITER
  */
-#define MAX_CPUS   8
+#define MAX_CPUS   9
 #define ITERATIONS 1000
 #define EACH_CPU_INC_PER_ITER 2
@@ -40,5 +40,5 @@
 	smp_call_t call_info[MAX_CPUS];
 	
-	size_t cpu_count = min(config.cpu_count, MAX_CPUS);
+	unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
 	
 	for (int iter = 0; iter < ITERATIONS; ++iter) {
@@ -75,4 +75,8 @@
 }
 
+static size_t calc_exp_calls(size_t thread_cnt)
+{
+	return thread_cnt * ITERATIONS * EACH_CPU_INC_PER_ITER;
+}
 
 const char *test_smpcall1(void)
@@ -82,5 +86,5 @@
 	thread_t *thread[MAX_CPUS] = {0};
 	
-	unsigned int cpu_count = min(config.cpu_count, MAX_CPUS);
+	unsigned int cpu_count = min(config.cpu_active, MAX_CPUS);
 	size_t running_thread_cnt = 0;
 
@@ -100,5 +104,9 @@
 	}
 
-	TPRINTF("Running %u wired threads.\n", running_thread_cnt);
+	size_t exp_calls = calc_exp_calls(running_thread_cnt);
+	size_t exp_calls_sum = exp_calls * cpu_count;
+	
+	TPRINTF("Running %zu wired threads. Expecting %zu calls. Be patient.\n", 
+		running_thread_cnt, exp_calls_sum);
 
 	for (unsigned int i = 0; i < cpu_count; ++i) {
@@ -112,11 +120,9 @@
 		if (thread[i] != NULL) {
 			thread_join(thread[i]);
+			thread_detach(thread[i]);
 		}
 	}
 
 	TPRINTF("Threads finished. Checking number of smp_call()s.\n");
-	
-	size_t exp_calls = running_thread_cnt * ITERATIONS * EACH_CPU_INC_PER_ITER;
-	size_t exp_calls_sum = exp_calls * cpu_count;
 	
 	bool ok = true;
@@ -127,5 +133,5 @@
 			if (call_cnt[i] != exp_calls) {
 				ok = false;
-				TPRINTF("Error: %u instead of %u cpu%u's calls were"
+				TPRINTF("Error: %zu instead of %zu cpu%u's calls were"
 					" acknowledged.\n", call_cnt[i], exp_calls, i);
 			} 
@@ -136,5 +142,5 @@
 	
 	if (calls_sum != exp_calls_sum) {
-		TPRINTF("Error: total acknowledged sum: %u instead of %u.\n",
+		TPRINTF("Error: total acknowledged sum: %zu instead of %zu.\n",
 			calls_sum, exp_calls_sum);
 		
@@ -143,5 +149,5 @@
 	
 	if (ok) {
-		TPRINTF("Success: number of received smp_calls is as expected (%u).\n",
+		TPRINTF("Success: number of received smp_calls is as expected (%zu).\n",
 			exp_calls_sum);
 		return NULL;
