From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Q: nr_threads locking
Date: Mon, 21 Apr 2003 20:49:49 +0200 [thread overview]
Message-ID: <3EA43D4D.7030507@colorfullife.com> (raw)
In-Reply-To: <20030421112858.35e2d7b5.akpm@digeo.com>
[-- Attachment #1: Type: text/plain, Size: 360 bytes --]
Andrew Morton wrote:
>It would be possible, yes.
>
>But thread creation is a "rare" event compared to pagefaults and syscalls.
>An atomic_t will be OK there.
>
>
Actually, the code is correct. The documentation it bogus. lock_kernel()
never achieved any protection: the copy_xy() functions can sleep.
What about the attached docu update?
--
Manfred
[-- Attachment #2: patch-nrthreads --]
[-- Type: text/plain, Size: 862 bytes --]
--- 2.5/kernel/fork.c 2003-04-20 11:19:14.000000000 +0200
+++ build-2.5/kernel/fork.c 2003-04-21 20:44:37.000000000 +0200
@@ -43,7 +43,9 @@
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 @@
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;
prev parent reply other threads:[~2003-04-21 18:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-21 13:25 Q: nr_threads locking Manfred Spraul
2003-04-21 18:28 ` Andrew Morton
2003-04-21 18:49 ` Manfred Spraul [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3EA43D4D.7030507@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@digeo.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.