lkml.org 
[lkml]   [2005]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[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>

--- linux-2.6/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -2301,14 +2327,14 @@ static void check_rlimit(struct task_str
cputime_t total, tmp;

total = cputime_add(p->utime, p->stime);
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur);
+ tmp = secs_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur);
if (unlikely(cputime_gt(total, tmp))) {
/* Send SIGXCPU every second. */
tmp = cputime_sub(total, cputime);
if (cputime_to_secs(tmp) < cputime_to_secs(total))
send_sig(SIGXCPU, p, 1);
/* and SIGKILL when we go over max.. */
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max);
+ tmp = secs_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max);
if (cputime_gt(total, tmp))
send_sig(SIGKILL, p, 1);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.030 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site