@@ -181,10 +181,14 @@ void __init fork_init(unsigned long mempages)
/*
* The default maximum number of threads is set to a safe
- * value: the thread structures can take up at most half
- * of memory.
+ * value: the thread structures can take up at most
+ * (1/8) part of memory.
*/
+#if (8 * THREAD_SIZE) > PAGE_SIZE
max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);
+#else
+ max_threads = mempages * (PAGE_SIZE / (8 * THREAD_SIZE));
+#endif
/*
* we need to allow at least 20 threads to boot a system