From: Rik van Riel <riel@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Mel Gorman <mgorman@suse.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Benjamin Serebrin <serebrin@google.com>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH RFC UGLY] x86,mm,sched: make lazy TLB mode even lazier
Date: Mon, 29 Aug 2016 10:54:22 -0400 [thread overview]
Message-ID: <1472482462.32433.92.camel@redhat.com> (raw)
In-Reply-To: <CALCETrXUoWkU9pauGq-oF59L7H7KmUnTWSXzPvE5TpY9zZHLPA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]
On Sun, 2016-08-28 at 01:11 -0700, Andy Lutomirski wrote:
> On Aug 25, 2016 9:06 PM, "Rik van Riel" <riel@redhat.com> wrote:
> >
> > Subject: x86,mm,sched: make lazy TLB mode even lazier
> >
> > Lazy TLB mode can result in an idle CPU being woken up for a TLB
> > flush, when all it really needed to do was flush %cr3 before the
> > next context switch.
> >
> > This is mostly fine on bare metal, though sub-optimal from a power
> > saving point of view, and deeper C states could make TLB flushes
> > take a little longer than desired.
> >
> > On virtual machines, the pain can be much worse, especially if a
> > currently non-running VCPU is woken up for a TLB invalidation
> > IPI, on a CPU that is busy running another task. It could take
> > a while before that IPI is handled, leading to performance issues.
> >
> > This patch is still ugly, and the sched.h include needs to be
> > cleaned
> > up a lot (how would the scheduler people like to see the context
> > switch
> > blocking abstracted?)
> >
> > This patch deals with the issue by introducing a third tlb state,
> > TLBSTATE_FLUSH, which causes %cr3 to be flushed at the next
> > context switch. A CPU is transitioned from TLBSTATE_LAZY to
> > TLBSTATE_FLUSH with the rq lock held, to prevent context switches.
> >
> > Nothing is done for a CPU that is already in TLBSTATE_FLUH mode.
> >
> > This patch is totally untested, because I am at a conference right
> > now, and Benjamin has the test case :)
> >
>
> I haven't had a chance to seriously read the code yet, but what
> happens when the mm is deleted outright? Or is the idea that a
> reference is held until all the lazy users are gone, too?
Worst case we send a TLB flush to a CPU that does
not need it.
As not sending an IPI will be faster than sending
one, I do not think the tradeoff will be much
different for a system with PCID.
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-29 15:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 19:04 [PATCH RFC UGLY] x86,mm,sched: make lazy TLB mode even lazier Rik van Riel
2016-08-25 19:42 ` H. Peter Anvin
2016-08-25 19:52 ` Rik van Riel
2016-08-25 20:15 ` [PATCH RFC v2] " Rik van Riel
2016-08-25 21:01 ` [PATCH RFC v3] " Rik van Riel
2016-08-27 8:03 ` Ingo Molnar
2016-08-27 23:02 ` Linus Torvalds
2016-08-30 19:53 ` [PATCH RFC v4] " Rik van Riel
2016-08-30 21:09 ` [PATCH RFC v5] " Rik van Riel
2016-08-31 16:27 ` [PATCH RFC v6] " Rik van Riel
2016-09-08 6:56 ` Ingo Molnar
2016-09-09 0:09 ` Benjamin Serebrin
2016-09-09 4:39 ` Andy Lutomirski
2016-09-09 7:44 ` Peter Zijlstra
2017-04-25 3:30 ` Andy Lutomirski
2016-08-29 15:24 ` [PATCH RFC v3] " Rik van Riel
2016-08-29 16:08 ` [PATCH RFC UGLY] " Rik van Riel
2016-08-28 8:11 ` Andy Lutomirski
2016-08-29 14:54 ` Rik van Riel [this message]
2016-08-29 23:55 ` Andy Lutomirski
2016-08-30 1:14 ` H. Peter Anvin
2016-08-30 18:23 ` Andy Lutomirski
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=1472482462.32433.92.camel@redhat.com \
--to=riel@redhat.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=serebrin@google.com \
--cc=tglx@linutronix.de \
/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