Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 350128
b: refs/heads/master
c: 6218845
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Jan 27, 2013
1 parent 4f15255 commit 27cc9a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 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: 57d2aa00dcec67afa52478730f2b524521af14fb
refs/heads/master: 62188451f0d63add7ad0cd2a1ae269d600c1663d
18 changes: 9 additions & 9 deletions trunk/kernel/sched/cputime.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,11 @@ EXPORT_SYMBOL_GPL(vtime_account);
# define nsecs_to_cputime(__nsecs) nsecs_to_jiffies(__nsecs)
#endif

static cputime_t scale_utime(cputime_t utime, cputime_t rtime, cputime_t total)
static cputime_t scale_stime(cputime_t stime, cputime_t rtime, cputime_t total)
{
u64 temp = (__force u64) rtime;

temp *= (__force u64) utime;
temp *= (__force u64) stime;

if (sizeof(cputime_t) == 4)
temp = div_u64(temp, (__force u32) total);
Expand All @@ -531,10 +531,10 @@ static void cputime_adjust(struct task_cputime *curr,
struct cputime *prev,
cputime_t *ut, cputime_t *st)
{
cputime_t rtime, utime, total;
cputime_t rtime, stime, total;

utime = curr->utime;
total = utime + curr->stime;
stime = curr->stime;
total = stime + curr->utime;

/*
* Tick based cputime accounting depend on random scheduling
Expand All @@ -549,17 +549,17 @@ static void cputime_adjust(struct task_cputime *curr,
rtime = nsecs_to_cputime(curr->sum_exec_runtime);

if (total)
utime = scale_utime(utime, rtime, total);
stime = scale_stime(stime, rtime, total);
else
utime = rtime;
stime = rtime;

/*
* If the tick based count grows faster than the scheduler one,
* the result of the scaling may go backward.
* Let's enforce monotonicity.
*/
prev->utime = max(prev->utime, utime);
prev->stime = max(prev->stime, rtime - prev->utime);
prev->stime = max(prev->stime, stime);
prev->utime = max(prev->utime, rtime - prev->stime);

*ut = prev->utime;
*st = prev->stime;
Expand Down

0 comments on commit 27cc9a1

Please sign in to comment.