[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180125092233.GE2295@hirez.programming.kicks-ass.net>
Date: Thu, 25 Jan 2018 10:22:33 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
KarimAllah Ahmed <karahmed@...zon.de>,
Andi Kleen <ak@...ux.intel.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andy Lutomirski <luto@...nel.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Ashok Raj <ashok.raj@...el.com>,
Asit Mallick <asit.k.mallick@...el.com>,
Borislav Petkov <bp@...e.de>,
Dan Williams <dan.j.williams@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Janakarajan Natarajan <Janakarajan.Natarajan@....com>,
Joerg Roedel <joro@...tes.org>,
Jun Nakajima <jun.nakajima@...el.com>,
Laura Abbott <labbott@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>, rkrcmar@...hat.com,
Thomas Gleixner <tglx@...utronix.de>,
Tom Lendacky <thomas.lendacky@....com>, x86@...nel.org
Subject: Re: [RFC PATCH 1/2] x86/ibpb: Skip IBPB when we switch back to same
user process
On Thu, Jan 25, 2018 at 09:58:20AM +0100, Peter Zijlstra wrote:
> On Wed, Jan 24, 2018 at 04:36:41PM -0800, Tim Chen wrote:
> > These two patches provide optimization to skip IBPB for this
> > commonly encountered scenario:
> > We could switch to a kernel idle thread and then back to the original
> > process such as:
> > process A -> idle -> process A
> >
> > In such scenario, we do not have to do IBPB here even though the process
> > is non-dumpable, as we are switching back to the same process after
> > an hiatus.
> >
> > The cost is to have an extra pointer to track the last mm we were using before
> > switching to the init_mm used by idle. But avoiding the extra IBPB
> > is probably worth the extra memory for such a common scenario.
>
> So we already track active_mm for kernel threads. I can't immediately
> see where this fails for idle and your changelog doesn't say.
idle_task_exit() explicitly switches back to init_mm when we take the
CPU offline, this very much suggests the active_mm thing works for idle
too.
This means that 'A -> idle -> A' should never pass through switch_mm to
begin with.
Please clarify how you think it does.
Powered by blists - more mailing lists