Skip to content

Commit

Permalink
posix cpu timers: fix timer ordering
Browse files Browse the repository at this point in the history
Pointed out by Oleg Nesterov, who has been walking over the code
forwards and backwards.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Linus Torvalds committed Oct 26, 2005
1 parent b0917bd commit 70ab81c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions kernel/posix-cpu-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,17 +576,15 @@ static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
listpos = head;
if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {
list_for_each_entry(next, head, entry) {
if (next->expires.sched > nt->expires.sched) {
listpos = &next->entry;
if (next->expires.sched > nt->expires.sched)
break;
}
listpos = &next->entry;
}
} else {
list_for_each_entry(next, head, entry) {
if (cputime_gt(next->expires.cpu, nt->expires.cpu)) {
listpos = &next->entry;
if (cputime_gt(next->expires.cpu, nt->expires.cpu))
break;
}
listpos = &next->entry;
}
}
list_add(&nt->entry, listpos);
Expand Down

0 comments on commit 70ab81c

Please sign in to comment.