diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 2c076b36c4f66b6dfedc986408306e644338f449..0b7c82ac467eb1db24e0614fe7cc1d2704d27a48 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -1020,7 +1020,8 @@ static void check_thread_timers(struct task_struct *tsk, unsigned long hard = sig->rlim[RLIMIT_RTTIME].rlim_max; unsigned long *soft = &sig->rlim[RLIMIT_RTTIME].rlim_cur; - if (tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { + if (hard != RLIM_INFINITY && + tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { /* * At the hard limit, we just die. * No need to calculate anything else now. diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index f1f215db3bd0d8f16859a2164d65dc5cbefa9cf5..2dac5ebb8bcb186c90ae781336b31148532f2e10 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c @@ -1125,13 +1125,7 @@ static void watchdog(struct rq *rq, struct task_struct *p) p->rt.timeout++; next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ); - if (next > p->rt.timeout) { - u64 next_time = p->se.sum_exec_runtime; - - next_time += next * (NSEC_PER_SEC/HZ); - if (p->it_sched_expires > next_time) - p->it_sched_expires = next_time; - } else + if (p->rt.timeout > next) p->it_sched_expires = p->se.sum_exec_runtime; } }