mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] cputime_t patches broke RLIMIT_CPU
Date: Wed, 19 Jan 2005 12:54:44 -0800	[thread overview]
Message-ID: <200501192054.j0JKsiFw002526@magilla.sf.frob.com> (raw)

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);
 	}

             reply	other threads:[~2005-01-19 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-19 20:54 Roland McGrath [this message]
2005-01-20  0:09 ` Linus Torvalds
2005-01-20  0:26   ` Roland McGrath
2005-01-20  0:47     ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200501192054.j0JKsiFw002526@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®