Re: [PATCH] Force processes to non-realtime before mm_exit

From: Thomas Gleixner
Date: Fri Sep 02 2016 - 11:04:55 EST


On Thu, 14 Jul 2016, Peter Zijlstra wrote:
> On Fri, Jun 03, 2016 at 04:18:44PM -0700, Brian Silverman wrote:
> > Without this, a realtime process which has called mlockall exiting
> > causes large latencies for other realtime processes at the same or
> > lower priorities. This seems like a fairly common use case too, because
> > realtime processes generally want their memory locked into RAM.
>
> So I'm not too sure.. SCHED_FIFO/RR are a complete trainwreck and
> provide absolutely no isolation from badly behaving tasks what so ever,
> so I'm not too inclined to protect them from exit either, its just one
> more way in which they can cause pain.
>
> But aside from the, the patch has issues..
>
> > +++ b/kernel/exit.c
> > @@ -730,6 +730,12 @@ void do_exit(long code)
> > tsk->exit_code = code;
> > taskstats_exit(tsk, group_dead);
> >
> > + if (tsk->policy == SCHED_FIFO || tsk->policy == SCHED_RR) {
> > + struct sched_param param = { .sched_priority = 0 };
> > +
> > + sched_setscheduler_nocheck(current, SCHED_NORMAL, &param);
> > + }
> > +
> > exit_mm(tsk);
>
> That only does half a job. You forget about SCHED_DEADLINE and negative
> nice tasks.
>
> Something like the below perhaps... But yeah, unconvinced.

I agree that FIFO/RR can cause pain, but running exit_mm() with RT priority
or consuming DL time is silly.

FWIW: Acked-by-me