Commit f5c49d6f authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] cputime_t patches broke RLIMIT_CPU

The RLIMIT_CPU limit is in seconds, not in jiffies.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b57bbdb1
...@@ -2299,17 +2299,17 @@ static void account_it_prof(struct task_struct *p, cputime_t cputime) ...@@ -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) static void check_rlimit(struct task_struct *p, cputime_t cputime)
{ {
cputime_t total, tmp; cputime_t total, tmp;
unsigned long secs;
total = cputime_add(p->utime, p->stime); total = cputime_add(p->utime, p->stime);
tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur); secs = cputime_to_secs(total);
if (unlikely(cputime_gt(total, tmp))) { if (unlikely(secs >= p->signal->rlim[RLIMIT_CPU].rlim_cur)) {
/* Send SIGXCPU every second. */ /* Send SIGXCPU every second. */
tmp = cputime_sub(total, cputime); 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); send_sig(SIGXCPU, p, 1);
/* and SIGKILL when we go over max.. */ /* and SIGKILL when we go over max.. */
tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max); if (secs >= p->signal->rlim[RLIMIT_CPU].rlim_max)
if (cputime_gt(total, tmp))
send_sig(SIGKILL, p, 1); send_sig(SIGKILL, p, 1);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment