Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2005-01-20 21:48:33 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-20 21:48:33 -0800
commitf5c49d6fe76b01a9d16fb2f6bf74575e4f82d87b (patch)
tree5f1d64b3e26102b9e6c5926f710ee16c28ca9974
parentb57bbdb10b4823de638fa1d5439c15b1b54b1f12 (diff)
[PATCH] cputime_t patches broke RLIMIT_CPU
The RLIMIT_CPU limit is in seconds, not in jiffies. Signed-off-by: Roland McGrath <roland@redhat.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--kernel/sched.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 8a657fb1643e..cb5d259dae6e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2299,17 +2299,17 @@ static void account_it_prof(struct task_struct *p, cputime_t cputime)
static void check_rlimit(struct task_struct *p, cputime_t cputime)
{
cputime_t total, tmp;
+ unsigned long secs;
total = cputime_add(p->utime, p->stime);
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur);
- if (unlikely(cputime_gt(total, tmp))) {
+ secs = cputime_to_secs(total);
+ if (unlikely(secs >= p->signal->rlim[RLIMIT_CPU].rlim_cur)) {
/* Send SIGXCPU every second. */
tmp = cputime_sub(total, cputime);
- if (cputime_to_secs(tmp) < cputime_to_secs(total))
+ if (cputime_to_secs(tmp) < secs)
send_sig(SIGXCPU, p, 1);
/* and SIGKILL when we go over max.. */
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max);
- if (cputime_gt(total, tmp))
+ if (secs >= p->signal->rlim[RLIMIT_CPU].rlim_max)
send_sig(SIGKILL, p, 1);
}
}