Skip to contentSkip to conversation

Fork fix fix

PATCH New David Howells 1 participant 1 message Nov 16, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fork fix fix

The attached patch fixes the fork fix to avoid the divide-by-zero error I'd previously fixed, but without using any sort of conditional.

---
warthog>diffstat fork-2610rc2mm1.diff

 fork.c |    5 +----
 1 files changed, 1 insertion(+), 4 deletions(-)
kernel/fork.c renamed from warthog/kernels/linux-2.6.10-rc2-mm1/kernel/fork.c +1 -4
diff -uNrp /warthog/kernels/linux-2.6.10-rc2-mm1/kernel/fork.c linux-2.6.10-rc2-mm1-frv/kernel/fork.c
@@ -120,10 +120,7 @@ void __init fork_init(unsigned long memp
 	 * value: the thread structures can take up at most half
 	 * of memory.
 	 */
-	if (THREAD_SIZE >= PAGE_SIZE)
-		max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8;
-	else
-		max_threads = mempages / 8;
+	max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE);
 
 	/*
 	 * we need to allow at least 20 threads to boot a system