]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] sane minimum proc count
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Sun, 6 Oct 2002 08:57:58 +0000 (01:57 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 6 Oct 2002 08:57:58 +0000 (01:57 -0700)
Again from UCLinux merge but relevant on its own for any embedded tiny box

kernel/fork.c

index 35728b794bce2a05b8b1c4f33ff139b8402463af..9375e08fb8ce65cfb397824771430d6f6a018f3a 100644 (file)
@@ -166,8 +166,11 @@ void __init fork_init(unsigned long mempages)
         */
        max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8;
 
-       init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
-       init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
+       /*
+        * we need to allow at least 10 threads to boot a system
+        */
+       init_task.rlim[RLIMIT_NPROC].rlim_cur = max(10, max_threads/2);
+       init_task.rlim[RLIMIT_NPROC].rlim_max = max(10, max_threads/2);
 }
 
 static struct task_struct *dup_task_struct(struct task_struct *orig)