summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-04-29 17:33:13 -0700
committerChristoph Hellwig <hch@lst.de>2003-04-29 17:33:13 -0700
commit75ab6eef09e017eff1006603fc4ac7c04cc6d7d7 (patch)
tree4a3b2b585122fc55f775652d2726424d0610194f /kernel
parentd514577e5425ac8985d91715303f1373e394dee8 (diff)
[PATCH] update nr_threads commentary
From: Manfred Spraul <manfred@colorfullife.com> Update some no-longer-true comments around nr_threads locking.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 58111cbdb54e..e34abd2241fb 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -43,7 +43,9 @@ static kmem_cache_t *task_struct_cachep;
extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
extern void exit_semundo(struct task_struct *tsk);
-/* The idle threads do not count.. */
+/* The idle threads do not count..
+ * Protected by write_lock_irq(&tasklist_lock)
+ */
int nr_threads;
int max_threads;
@@ -792,9 +794,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
atomic_inc(&p->user->processes);
/*
- * Counter increases are protected by
- * the kernel lock so nr_threads can't
- * increase under us (but it may decrease).
+ * If multiple threads are within copy_process(), then this check
+ * triggers too late. This doesn't hurt, the check is only there
+ * to stop root fork bombs.
*/
if (nr_threads >= max_threads)
goto bad_fork_cleanup_count;