[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVP3asoqWyNqEe+rDs+YECd9gnp9eFb1==X0140oMZ41g@mail.gmail.com>
Date: Fri, 1 Oct 2021 09:12:34 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [patch 4/5] sched: Delay task stack freeing on RT
On Wed, Sep 29, 2021 at 4:54 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Tue, Sep 28, 2021 at 02:24:30PM +0200, Thomas Gleixner wrote:
>
> > --- a/kernel/exit.c
> > +++ b/kernel/exit.c
> > @@ -172,6 +172,11 @@ static void delayed_put_task_struct(stru
> > kprobe_flush_task(tsk);
> > perf_event_delayed_put(tsk);
> > trace_sched_process_free(tsk);
> > +
> > + /* RT enabled kernels delay freeing the VMAP'ed task stack */
> > + if (IS_ENABLED(CONFIG_PREEMPT_RT))
> > + put_task_stack(tsk);
> > +
> > put_task_struct(tsk);
> > }
>
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -4846,8 +4846,12 @@ static struct rq *finish_task_switch(str
> > if (prev->sched_class->task_dead)
> > prev->sched_class->task_dead(prev);
> >
> > - /* Task is done with its stack. */
> > - put_task_stack(prev);
> > + /*
> > + * Release VMAP'ed task stack immediate for reuse. On RT
> > + * enabled kernels this is delayed for latency reasons.
> > + */
> > + if (!IS_ENABLED(CONFIG_PREEMPT_RT))
> > + put_task_stack(prev);
> >
> > put_task_struct_rcu_user(prev);
> > }
>
>
> Having this logic split across two files seems unfortunate and prone to
> 'accidents'. Is there a real down-side to unconditionally doing it in
> delayed_put_task_struct() ?
>
> /me goes out for lunch... meanwhile tglx points at: 68f24b08ee89.
>
> Bah.. Andy?
Could we make whatever we do here unconditional? And what actually
causes the latency? If it's vfree, shouldn't the existing use of
vfree_atomic() in free_thread_stack() handle it? Or is it the
accounting?
--
Andy Lutomirski
AMA Capital Management, LLC
Powered by blists - more mailing lists