diff options
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 91843ba7f237..2f76e06bea58 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2904,6 +2904,19 @@ unsigned long nr_iowait(void) | |||
2904 | return sum; | 2904 | return sum; |
2905 | } | 2905 | } |
2906 | 2906 | ||
2907 | unsigned long nr_iowait_cpu(void) | ||
2908 | { | ||
2909 | struct rq *this = this_rq(); | ||
2910 | return atomic_read(&this->nr_iowait); | ||
2911 | } | ||
2912 | |||
2913 | unsigned long this_cpu_load(void) | ||
2914 | { | ||
2915 | struct rq *this = this_rq(); | ||
2916 | return this->cpu_load[0]; | ||
2917 | } | ||
2918 | |||
2919 | |||
2907 | /* Variables and functions for calc_load */ | 2920 | /* Variables and functions for calc_load */ |
2908 | static atomic_long_t calc_load_tasks; | 2921 | static atomic_long_t calc_load_tasks; |
2909 | static unsigned long calc_load_update; | 2922 | static unsigned long calc_load_update; |
@@ -5079,17 +5092,16 @@ void account_idle_time(cputime_t cputime) | |||
5079 | */ | 5092 | */ |
5080 | void account_process_tick(struct task_struct *p, int user_tick) | 5093 | void account_process_tick(struct task_struct *p, int user_tick) |
5081 | { | 5094 | { |
5082 | cputime_t one_jiffy = jiffies_to_cputime(1); | 5095 | cputime_t one_jiffy_scaled = cputime_to_scaled(cputime_one_jiffy); |
5083 | cputime_t one_jiffy_scaled = cputime_to_scaled(one_jiffy); | ||
5084 | struct rq *rq = this_rq(); | 5096 | struct rq *rq = this_rq(); |
5085 | 5097 | ||
5086 | if (user_tick) | 5098 | if (user_tick) |
5087 | account_user_time(p, one_jiffy, one_jiffy_scaled); | 5099 | account_user_time(p, cputime_one_jiffy, one_jiffy_scaled); |
5088 | else if ((p != rq->idle) || (irq_count() != HARDIRQ_OFFSET)) | 5100 | else if ((p != rq->idle) || (irq_count() != HARDIRQ_OFFSET)) |
5089 | account_system_time(p, HARDIRQ_OFFSET, one_jiffy, | 5101 | account_system_time(p, HARDIRQ_OFFSET, cputime_one_jiffy, |
5090 | one_jiffy_scaled); | 5102 | one_jiffy_scaled); |
5091 | else | 5103 | else |
5092 | account_idle_time(one_jiffy); | 5104 | account_idle_time(cputime_one_jiffy); |
5093 | } | 5105 | } |
5094 | 5106 | ||
5095 | /* | 5107 | /* |