Re: [PATCH v8 4/7] cgroup: cgroup v2 freezer
From: Roman Gushchin
Date: Wed Feb 20 2019 - 17:15:47 EST
On Wed, Feb 20, 2019 at 03:42:02PM +0100, Oleg Nesterov wrote:
> On 02/19, Roman Gushchin wrote:
> >
> > @@ -2065,6 +2066,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, kernel_siginfo_t
> > preempt_disable();
> > read_unlock(&tasklist_lock);
> > preempt_enable_no_resched();
> > + cgroup_enter_stopped();
> > freezable_schedule();
> > } else {
> > /*
> > @@ -2243,6 +2245,7 @@ static bool do_signal_stop(int signr)
> > }
> >
> > /* Now we don't run again until woken by SIGCONT or SIGKILL */
> > + cgroup_enter_stopped();
> > freezable_schedule();
> > return true;
>
> Please see my reply to 0/7.
Answered in that thread.
>
> > @@ -2280,7 +2286,8 @@ static void do_jobctl_trap(void)
> > !(signal->flags & SIGNAL_STOP_STOPPED))
> > signr = SIGTRAP;
> > WARN_ON_ONCE(!signr);
> > - ptrace_do_notify(signr, signr | (PTRACE_EVENT_STOP << 8),
> > + ptrace_do_notify(signr,
> > + signr | (PTRACE_EVENT_STOP << 8),
> > CLD_STOPPED);
>
> white-space cleanup?
Sorry, a bogus change. Please, ignore it.
>
> > @@ -2363,7 +2419,8 @@ bool get_signal(struct ksignal *ksig)
> > * we should notify the parent, prepare_signal(SIGCONT) encodes
> > * the CLD_ si_code into SIGNAL_CLD_MASK bits.
> > */
> > - if (unlikely(signal->flags & SIGNAL_CLD_MASK)) {
> > + if (unlikely(signal->flags & SIGNAL_CLD_MASK) &
> > + !(current->jobctl & JOBCTL_TRAP_FREEZE)) {
>
> Hmm, why?
If a process is going from the stopped to the frozen state, it looks like
it's better to delay parent's notification up to the moment when it will
actually run.
Thanks!