[lkml]   [2001]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] saner limit for max_threads

by default the limit for max_threads is such that
the system will try to allocate up to half the
physical memory in task_structs.

Because for each 8kB task struct we'll often want
a struct_mm, a page directory, 3 page tables and
some more structures, this means that a fork bomb
will leave the box DEAD with root never ever getting
a chance of using his reserved tasks and killing the
bad user.

The patch below adjusts the max_threads calculation
to something which should be more sane, though quite
possibly still to high...

Please apply for the next -pre kernel.



--- linux-2.4.6-pre3/kernel/fork.c.orig Sun Jun 17 20:45:54 2001
+++ linux-2.4.6-pre3/kernel/fork.c Sun Jun 17 23:07:20 2001
@@ -70,7 +70,7 @@
* value: the thread structures can take up at most half
* of memory.
- max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 2;
+ max_threads = mempages / (THREAD_SIZE/PAGE_SIZE) / 16;

init_task.rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
init_task.rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:55    [W:0.023 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site