Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24917
b: refs/heads/master
c: db1b1fe
h: refs/heads/master
i:
  24915: 30a5205
v: v3
  • Loading branch information
Jack Steiner authored and Linus Torvalds committed Mar 31, 2006
1 parent 6cc4f7a commit 4e5ab33
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3055addadbe9bfb2365006a1c13fd342a8d30d52
refs/heads/master: db1b1fefc2cecbff2e4214062fa8c680cb6e7b7d
1 change: 1 addition & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ DECLARE_PER_CPU(unsigned long, process_counts);
extern int nr_processes(void);
extern unsigned long nr_running(void);
extern unsigned long nr_uninterruptible(void);
extern unsigned long nr_active(void);
extern unsigned long nr_iowait(void);

#include <linux/time.h>
Expand Down
15 changes: 15 additions & 0 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,21 @@ unsigned long nr_iowait(void)
return sum;
}

unsigned long nr_active(void)
{
unsigned long i, running = 0, uninterruptible = 0;

for_each_online_cpu(i) {
running += cpu_rq(i)->nr_running;
uninterruptible += cpu_rq(i)->nr_uninterruptible;
}

if (unlikely((long)uninterruptible < 0))
uninterruptible = 0;

return running + uninterruptible;
}

#ifdef CONFIG_SMP

/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ void update_process_times(int user_tick)
*/
static unsigned long count_active_tasks(void)
{
return (nr_running() + nr_uninterruptible()) * FIXED_1;
return nr_active() * FIXED_1;
}

/*
Expand Down

0 comments on commit 4e5ab33

Please sign in to comment.