Re: 2.6.28, limiting cpu time doesn't work
From: Peter Lojkin
Date: Sun Mar 22 2009 - 18:13:10 EST
Oleg Nesterov wrote:
> Found this message on http://bugzilla.kernel.org/show_bug.cgi?id=12911 ...
>
> I _think_ posix_cpu_timers_init_group() is not right, it should copy
> cputime_expires->prof_exp.
>
> Peter, any chance you can test the (uncompiled/untested) patch below?
yes, with this patch 2.6.28.8 works as expected, thank you!
> Also, I assume that something like
>
> $ ulimit -t 3
> $ while true; do true; done
>
> kills the shell correctly, yes?
yes, i've found it after original message and posted it in follow up:
http://marc.info/?l=linux-kernel&m=123770019023095&w=4
> 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?
if you need to test any more patches on the subject i'm ready to do it.
regression test system for our project depends on ability to limit cpu time,
so it's major problem for us...
> --- 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. */
> INIT_LIST_HEAD(&sig->cpu_timers[0]);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/