summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRobert Love <rml@tech9.net>2002-05-28 05:03:31 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-05-28 05:03:31 -0700
commit01bc15eda4218694be18921cd8699bcd9a8427df (patch)
treec28463b5e29fc1a758cd1185148de0ab2c465538 /include
parent5ff8f2bb405a6018e26560c16606d17234a6397e (diff)
[PATCH] O(1) count_active_tasks
This is William Irwin's algorithmically O(1) version of count_active_tasks (which is currently O(n) for n total tasks on the system). I like it a lot: we become O(1) because now we count uninterruptible tasks, so we can return (nr_uninterruptible + nr_running). It does not introduce any overhead or hurt the case for small n, so I have no complaints. This copy has a small optimization over the original posting, but is otherwise the same thing wli posted earlier. I have tested to make sure this returns accurate results and that the kernel profile improves.
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 743b1aea2aca..b62a724d437c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -80,6 +80,7 @@ extern unsigned long avenrun[]; /* Load averages */
extern int nr_threads;
extern int last_pid;
extern unsigned long nr_running(void);
+extern unsigned long nr_uninterruptible(void);
#include <linux/time.h>
#include <linux/param.h>