diff options
author | Prasanna Meda <pmeda@akamai.com> | 2005-01-04 05:28:28 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-01-04 05:28:28 -0800 |
commit | fe52f9669c249f2bc9c44c541a83b0c18120cb0d (patch) | |
tree | c699f3670e3e423d68ecac98fce315e1c3c3ea7c /kernel | |
parent | bb51bc5933d82005cf0625eaaaa16f7df1011ece (diff) | |
download | history-fe52f9669c249f2bc9c44c541a83b0c18120cb0d.tar.gz |
[PATCH] fork: total_forks not counted under tasklist_lock
Bring the total_forks under tasklist_lock. When most of the fork code
icluding nr_threads is moved to copy_process() from do_fork() code in 2.6,
this is left out.
Althought accuracy of total_forks is not important, it would be nice to add
this. It does not involve additional cost, and the code will be cleaner if
it is grouped with nr_threads. The difference is, total_forks will
increase on fork, but nr_threads will increase on fork and decrease on the
exit.
I also moved extern decleration to sched.h from proc_misc.c.
Signed-off-by: Prasanna Meda <pmeda@akamai.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/fork.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index a512c5e927d5f9..df53562ced51e5 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -48,13 +48,13 @@ #include <asm/cacheflush.h> #include <asm/tlbflush.h> -/* The idle threads do not count.. - * Protected by write_lock_irq(&tasklist_lock) +/* + * Protected counters by write_lock_irq(&tasklist_lock) */ -int nr_threads; - -int max_threads; unsigned long total_forks; /* Handle normal Linux uptimes. */ +int nr_threads; /* The idle threads do not count.. */ + +int max_threads; /* tunable limit on nr_threads */ DEFINE_PER_CPU(unsigned long, process_counts) = 0; @@ -1035,6 +1035,7 @@ static task_t *copy_process(unsigned long clone_flags, } nr_threads++; + total_forks++; write_unlock_irq(&tasklist_lock); retval = 0; @@ -1167,7 +1168,6 @@ long do_fork(unsigned long clone_flags, wake_up_new_task(p, clone_flags); else p->state = TASK_STOPPED; - ++total_forks; if (unlikely (trace)) { current->ptrace_message = pid; |