diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-01-25 15:08:32 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:32 -0500 |
commit | 5a52dd50091b6a6e710a1293db741028f8cc5aac (patch) | |
tree | ea2b361909e431c458c26208e501ea3cf10edd85 | |
parent | 1020387f5f3b52929b387103cf976321981f8e26 (diff) |
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: Peter Zijlsta <a.p.zijlstra@chello.nl>
CC: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/posix-cpu-timers.c | 3 | ||||
-rw-r--r-- | kernel/sched_rt.c | 8 |
2 files changed, 3 insertions, 8 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 2c076b36c4f6..0b7c82ac467e 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, | |||
1020 | unsigned long hard = sig->rlim[RLIMIT_RTTIME].rlim_max; | 1020 | unsigned long hard = sig->rlim[RLIMIT_RTTIME].rlim_max; |
1021 | unsigned long *soft = &sig->rlim[RLIMIT_RTTIME].rlim_cur; | 1021 | unsigned long *soft = &sig->rlim[RLIMIT_RTTIME].rlim_cur; |
1022 | 1022 | ||
1023 | if (tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { | 1023 | if (hard != RLIM_INFINITY && |
1024 | tsk->rt.timeout > DIV_ROUND_UP(hard, USEC_PER_SEC/HZ)) { | ||
1024 | /* | 1025 | /* |
1025 | * At the hard limit, we just die. | 1026 | * At the hard limit, we just die. |
1026 | * No need to calculate anything else now. | 1027 | * No need to calculate anything else now. |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index f1f215db3bd0..2dac5ebb8bcb 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) | |||
1125 | 1125 | ||
1126 | p->rt.timeout++; | 1126 | p->rt.timeout++; |
1127 | next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ); | 1127 | next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ); |
1128 | if (next > p->rt.timeout) { | 1128 | if (p->rt.timeout > next) |
1129 | u64 next_time = p->se.sum_exec_runtime; | ||
1130 | |||
1131 | next_time += next * (NSEC_PER_SEC/HZ); | ||
1132 | if (p->it_sched_expires > next_time) | ||
1133 | p->it_sched_expires = next_time; | ||
1134 | } else | ||
1135 | p->it_sched_expires = p->se.sum_exec_runtime; | 1129 | p->it_sched_expires = p->se.sum_exec_runtime; |
1136 | } | 1130 | } |
1137 | } | 1131 | } |