提交 5a52dd50 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

sched: rt-watchdog: fix .rlim_max = RLIM_INFINITY

Remove the curious logic to set it_sched_expires in the future. It useless
because rt.timeout wouldn't be incremented anyway.

Explicity check for RLIM_INFINITY as a test programm that had a 1s soft limit
and a inf hard limit would SIGKILL at 1s. This is because RLIM_INFINITY+d-1
is d-2.
Signed-off-by: NPeter Zijlsta <a.p.zijlstra@chello.nl>
CC: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 1020387f
...@@ -1020,7 +1020,8 @@ static void check_thread_timers(struct task_struct *tsk, ...@@ -1020,7 +1020,8 @@ static void check_thread_timers(struct task_struct *tsk,
unsigned long hard = sig->rlim[RLIMIT_RTTIME].rlim_max; unsigned long hard = sig->rlim[RLIMIT_RTTIME].rlim_max;
unsigned long *soft = &sig->rlim[RLIMIT_RTTIME].rlim_cur; 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. * At the hard limit, we just die.
* No need to calculate anything else now. * No need to calculate anything else now.
......
...@@ -1125,13 +1125,7 @@ static void watchdog(struct rq *rq, struct task_struct *p) ...@@ -1125,13 +1125,7 @@ static void watchdog(struct rq *rq, struct task_struct *p)
p->rt.timeout++; p->rt.timeout++;
next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ); next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ);
if (next > p->rt.timeout) { if (p->rt.timeout > next)
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
p->it_sched_expires = p->se.sum_exec_runtime; p->it_sched_expires = p->se.sum_exec_runtime;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册