summaryrefslogtreecommitdiff
path: root/kernel/acct.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-07-06 05:41:34 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-07-06 05:41:34 -0700
commitd24d1d3abedcd64a9fd90e602bbd45d73b9c0de0 (patch)
tree265485eb31094fe187996a5c0fd5150aeeea8105 /kernel/acct.c
parentd029f790d8ed6d277ef47eb1e1f99cdbc3f11017 (diff)
[PATCH] BSD accounting speedup
From: Ingo Molnar <mingo@elte.hu> Most distributions turn on process accounting - but even the common 'accounting is off' case is horrible SMP-scalability-wise: it accesses a global spinlock during every sys_exit() call, which bounces like mad on SMP (and NUMA) systems. (i also got rid of the unused return code.)
Diffstat (limited to 'kernel/acct.c')
-rw-r--r--kernel/acct.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index e63095525ac2..028e310bd15f 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -394,17 +394,26 @@ static void do_acct_process(long exitcode, struct file *file)
/*
* acct_process - now just a wrapper around do_acct_process
*/
-int acct_process(long exitcode)
+void acct_process(long exitcode)
{
struct file *file = NULL;
+
+ /*
+ * accelerate the common fastpath:
+ */
+ if (!acct_globals.file)
+ return;
+
spin_lock(&acct_globals.lock);
- if (acct_globals.file) {
- file = acct_globals.file;
- get_file(file);
- spin_unlock(&acct_globals.lock);
- do_acct_process(exitcode, file);
- fput(file);
- } else
- spin_unlock(&acct_globals.lock);
- return 0;
+ file = acct_globals.file;
+ if (!file)
+ goto out_unlock;
+
+ get_file(file);
+ spin_unlock(&acct_globals.lock);
+ do_acct_process(exitcode, file);
+ fput(file);
+
+out_unlock:
+ spin_unlock(&acct_globals.lock);
}