From: Peter Zijlstra <peterz@infradead.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, Peter Lojkin <ia6432@inbox.ru>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org, stable@kernel.org
Subject: Re: [PATCH 1/2] posix-timers: fix RLIMIT_CPU && fork()
Date: Sat, 28 Mar 2009 00:59:28 +0100 [thread overview]
Message-ID: <1238198368.4039.319.camel@laptop> (raw)
In-Reply-To: <20090327000607.GA10104@redhat.com>
On Fri, 2009-03-27 at 01:06 +0100, Oleg Nesterov wrote:
> See http://bugzilla.kernel.org/show_bug.cgi?id=12911
>
> copy_signal() copies signal->rlim, but RLIMIT_CPU is "lost". Because
> posix_cpu_timers_init_group() sets cputime_expires.prof_exp = 0 and thus
> fastpath_timer_check() returns false unless we have other expired cpu timers.
>
> Change copy_signal() to set cputime_expires.prof_exp if we have RLIMIT_CPU.
> Also, set cputimer.running = 1 in that case. This is not strictly necessary,
> but imho makes sense.
The other site that enables is also syncs the timer with the clock, but
since we're doing clone_signal, I presume there isn't much of a thread
group to sync to anyway.
Looks good, thanks for looking into this.
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Reported-by: Peter Lojkin <ia6432@inbox.ru>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
>
> --- 6.29/kernel/fork.c~1_FORK 2009-03-23 18:14:34.000000000 +0100
> +++ 6.29/kernel/fork.c 2009-03-27 00:25:52.000000000 +0100
> @@ -808,6 +808,12 @@ static void posix_cpu_timers_init_group(
> sig->cputime_expires.virt_exp = cputime_zero;
> sig->cputime_expires.sched_exp = 0;
>
> + if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
> + sig->cputime_expires.prof_exp =
> + secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
> + sig->cputimer.running = 1;
> + }
> +
> /* The timer lists. */
> INIT_LIST_HEAD(&sig->cpu_timers[0]);
> INIT_LIST_HEAD(&sig->cpu_timers[1]);
> @@ -823,11 +829,8 @@ static int copy_signal(unsigned long clo
> atomic_inc(¤t->signal->live);
> return 0;
> }
> - sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
> -
> - if (sig)
> - posix_cpu_timers_init_group(sig);
>
> + sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL);
> tsk->signal = sig;
> if (!sig)
> return -ENOMEM;
> @@ -865,6 +868,8 @@ static int copy_signal(unsigned long clo
> memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);
> task_unlock(current->group_leader);
>
> + posix_cpu_timers_init_group(sig);
> +
> acct_init_pacct(&sig->pacct);
>
> tty_audit_fork(sig);
>
next prev parent reply other threads:[~2009-03-28 0:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-27 0:06 Oleg Nesterov
2009-03-27 23:59 ` Peter Zijlstra [this message]
2009-03-31 3:01 ` [stable] " Chris Wright
2009-03-31 14:57 ` Oleg Nesterov
2009-04-08 16:09 ` [tip:timers/urgent] " Oleg Nesterov
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=1238198368.4039.319.camel@laptop \
--to=peterz@infradead.org \
--cc=ia6432@inbox.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=stable@kernel.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®