[lkml]   [2009]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: 2.6.28, limiting cpu time doesn't work
On 03/19, Peter Lojkin wrote:
> after upgrade to 2.6.28 ulimit -t doesn't work. for example:
> bash# ulimit -t 3; cpuhog
> (where cpuhog is any program that continuously use cpu)
> with cpuhog gets killed after 3sec as expected.
> with 2.6.28,, 2.6.29-rc8-git4 it's keep running indefinitely.
> ulimit -a and /proc/<pid>/limits show that cputime limit was set correctly.

Found this message on ...

I _think_ posix_cpu_timers_init_group() is not right, it should copy

Peter, any chance you can test the (uncompiled/untested) patch below?

Also, I assume that something like

$ ulimit -t 3
$ while true; do true; done

kills the shell correctly, yes? IOW, I suspect that ulimit works, but
cpuhog never check RLIMIT_CPU because fastpath_timer_check() always
returns 0 due to task_cputime_zero(&sig->cputime_expires) == T.

I'm afraid we need the fix fo 2.6.29 as well, but I am looking at rc3.

Hmm. check_process_timers() updates ->cputime_expires, but it never
clears (say) cputime_expires.prof_exp, why? Can't we just do

if (cputime_gt(sig->cputime_expires.prof_exp, prof_expires))
sig->cputime_expires.prof_exp = prof_expires;
at the end?

--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -790,9 +790,7 @@ static void posix_cpu_timers_init_group(
sig->it_prof_incr = cputime_zero;

/* Cached expiration times. */
- sig->cputime_expires.prof_exp = cputime_zero;
- sig->cputime_expires.virt_exp = cputime_zero;
- sig->cputime_expires.sched_exp = 0;
+ sig->cputime_expires = current->signal->cputime_expires;

/* The timer lists. */

 \ /
  Last update: 2009-03-22 21:21    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean