mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: PATCH: 2.5.40 sane minimum proc count
@ 2002-10-07 13:27 Matthew Wilcox
  2002-10-07 13:44 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2002-10-07 13:27 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel


        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);

why not simply:

	max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 8;

+	/* we need to allow at least 20 threads to boot a system */
+	if (max_threads < 20)
+		max_threads = 20;
+
	init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
	init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;

i think we're going to see more kernel threads with 2.5 than we did with 2.4;
let's be safer.

-- 
Revolutions do not require corporate support.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* PATCH: 2.5.40 sane minimum proc count
@ 2002-10-06 17:21 Alan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2002-10-06 17:21 UTC (permalink / raw)
  To: torvalds, linux-kernel

Again from UCLinux merge but relevant on its own for any embedded tiny box

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.2.5.40/kernel/fork.c linux.2.5.40-ac5/kernel/fork.c
--- linux.2.5.40/kernel/fork.c	2002-10-02 21:34:06.000000000 +0100
+++ linux.2.5.40-ac5/kernel/fork.c	2002-10-05 23:51:20.000000000 +0100
@@ -166,8 +166,11 @@
 	 */
 	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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-07 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-07 13:27 PATCH: 2.5.40 sane minimum proc count Matthew Wilcox
2002-10-07 13:44 ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2002-10-06 17:21 Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®