diff options
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | kernel/fork.c | 2 | ||||
-rw-r--r-- | kernel/sched.c | 16 |
3 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0395b0f4df3a..dff85e58264e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1331,7 +1331,9 @@ struct task_struct { | |||
1331 | 1331 | ||
1332 | cputime_t utime, stime, utimescaled, stimescaled; | 1332 | cputime_t utime, stime, utimescaled, stimescaled; |
1333 | cputime_t gtime; | 1333 | cputime_t gtime; |
1334 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
1334 | cputime_t prev_utime, prev_stime; | 1335 | cputime_t prev_utime, prev_stime; |
1336 | #endif | ||
1335 | unsigned long nvcsw, nivcsw; /* context switch counts */ | 1337 | unsigned long nvcsw, nivcsw; /* context switch counts */ |
1336 | struct timespec start_time; /* monotonic time */ | 1338 | struct timespec start_time; /* monotonic time */ |
1337 | struct timespec real_start_time; /* boot based time */ | 1339 | struct timespec real_start_time; /* boot based time */ |
diff --git a/kernel/fork.c b/kernel/fork.c index 166b8c49257c..ad7cb6d1193c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1066,8 +1066,10 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1066 | p->gtime = cputime_zero; | 1066 | p->gtime = cputime_zero; |
1067 | p->utimescaled = cputime_zero; | 1067 | p->utimescaled = cputime_zero; |
1068 | p->stimescaled = cputime_zero; | 1068 | p->stimescaled = cputime_zero; |
1069 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
1069 | p->prev_utime = cputime_zero; | 1070 | p->prev_utime = cputime_zero; |
1070 | p->prev_stime = cputime_zero; | 1071 | p->prev_stime = cputime_zero; |
1072 | #endif | ||
1071 | 1073 | ||
1072 | p->default_timer_slack_ns = current->timer_slack_ns; | 1074 | p->default_timer_slack_ns = current->timer_slack_ns; |
1073 | 1075 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 4883fee99314..17e2c1db2bde 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5184,10 +5184,8 @@ void account_idle_ticks(unsigned long ticks) | |||
5184 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | 5184 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING |
5185 | void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | 5185 | void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) |
5186 | { | 5186 | { |
5187 | if (ut) | 5187 | *ut = p->utime; |
5188 | *ut = p->utime; | 5188 | *st = p->stime; |
5189 | if (st) | ||
5190 | *st = p->stime; | ||
5191 | } | 5189 | } |
5192 | #else | 5190 | #else |
5193 | 5191 | ||
@@ -5197,7 +5195,7 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | |||
5197 | 5195 | ||
5198 | void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | 5196 | void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) |
5199 | { | 5197 | { |
5200 | cputime_t rtime, utime = p->utime, total = utime + p->stime; | 5198 | cputime_t rtime, utime = p->utime, total = cputime_add(utime, p->stime); |
5201 | 5199 | ||
5202 | /* | 5200 | /* |
5203 | * Use CFS's precise accounting: | 5201 | * Use CFS's precise accounting: |
@@ -5217,12 +5215,10 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | |||
5217 | * Compare with previous values, to keep monotonicity: | 5215 | * Compare with previous values, to keep monotonicity: |
5218 | */ | 5216 | */ |
5219 | p->prev_utime = max(p->prev_utime, utime); | 5217 | p->prev_utime = max(p->prev_utime, utime); |
5220 | p->prev_stime = max(p->prev_stime, rtime - p->prev_utime); | 5218 | p->prev_stime = max(p->prev_stime, cputime_sub(rtime, p->prev_utime)); |
5221 | 5219 | ||
5222 | if (ut) | 5220 | *ut = p->prev_utime; |
5223 | *ut = p->prev_utime; | 5221 | *st = p->prev_stime; |
5224 | if (st) | ||
5225 | *st = p->prev_stime; | ||
5226 | } | 5222 | } |
5227 | #endif | 5223 | #endif |
5228 | 5224 | ||