Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165324
b: refs/heads/master
c: d1e3b6d
h: refs/heads/master
v: v3
  • Loading branch information
Stanislaw Gruszka authored and Ingo Molnar committed Aug 3, 2009
1 parent 802231e commit 666c780
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 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: 8356b5f9c424e5831715abbce747197c30d1fd71
refs/heads/master: d1e3b6d195770bd422e3229b88edfc154b6a27dd
44 changes: 23 additions & 21 deletions trunk/kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,17 @@ static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
now);
}

static inline int expires_gt(cputime_t expires, cputime_t new_exp)
{
return cputime_eq(expires, cputime_zero) ||
cputime_gt(expires, new_exp);
}

static inline int expires_le(cputime_t expires, cputime_t new_exp)
{
return !cputime_eq(expires, cputime_zero) &&
cputime_le(expires, new_exp);
}
/*
* Insert the timer on the appropriate list before any timers that
* expire later. This must be called with the tasklist_lock held
Expand Down Expand Up @@ -585,31 +596,26 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
*/

if (CPUCLOCK_PERTHREAD(timer->it_clock)) {
union cpu_time_count *exp = &nt->expires;

switch (CPUCLOCK_WHICH(timer->it_clock)) {
default:
BUG();
case CPUCLOCK_PROF:
if (cputime_eq(p->cputime_expires.prof_exp,
cputime_zero) ||
cputime_gt(p->cputime_expires.prof_exp,
nt->expires.cpu))
p->cputime_expires.prof_exp =
nt->expires.cpu;
if (expires_gt(p->cputime_expires.prof_exp,
exp->cpu))
p->cputime_expires.prof_exp = exp->cpu;
break;
case CPUCLOCK_VIRT:
if (cputime_eq(p->cputime_expires.virt_exp,
cputime_zero) ||
cputime_gt(p->cputime_expires.virt_exp,
nt->expires.cpu))
p->cputime_expires.virt_exp =
nt->expires.cpu;
if (expires_gt(p->cputime_expires.virt_exp,
exp->cpu))
p->cputime_expires.virt_exp = exp->cpu;
break;
case CPUCLOCK_SCHED:
if (p->cputime_expires.sched_exp == 0 ||
p->cputime_expires.sched_exp >
nt->expires.sched)
p->cputime_expires.sched_exp > exp->sched)
p->cputime_expires.sched_exp =
nt->expires.sched;
exp->sched;
break;
}
} else {
Expand All @@ -623,17 +629,13 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
default:
BUG();
case CPUCLOCK_VIRT:
if (!cputime_eq(sig->it[CPUCLOCK_VIRT].expires,
cputime_zero) &&
cputime_lt(sig->it[CPUCLOCK_VIRT].expires,
if (expires_le(sig->it[CPUCLOCK_VIRT].expires,
exp->cpu))
break;
sig->cputime_expires.virt_exp = exp->cpu;
break;
case CPUCLOCK_PROF:
if (!cputime_eq(sig->it[CPUCLOCK_PROF].expires,
cputime_zero) &&
cputime_lt(sig->it[CPUCLOCK_PROF].expires,
if (expires_le(sig->it[CPUCLOCK_PROF].expires,
exp->cpu))
break;
i = sig->rlim[RLIMIT_CPU].rlim_cur;
Expand Down

0 comments on commit 666c780

Please sign in to comment.