From: Jonathan Morton <chromatix99@gmail.com>
To: "Steinar H. Gunderson" <sgunderson@bigfoot.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
"bloat@lists.bufferbloat.net" <bloat@lists.bufferbloat.net>
Subject: Re: [Bloat] Hardware upticks
Date: Wed, 6 Jan 2016 08:18:19 +0200 [thread overview]
Message-ID: <1AAED798-A2DC-4D90-B51A-7414930C3C21@gmail.com> (raw)
In-Reply-To: <20160106002213.GA8486@sesse.net>
> On 6 Jan, 2016, at 02:22, Steinar H. Gunderson <sgunderson@bigfoot.com> wrote:
>
> On Tue, Jan 05, 2016 at 04:06:03PM -0800, Stephen Hemminger wrote:
>> The expensive part is often having to save and restore all the state in
>> registers and other bits on context switch.
>
> Are you sure? There's not really all that much state to save, and all I've
> been taught before says the opposite.
>
> Also, I've never ever seen the actual context switch turn up high in a perf
> profile. Is this because of some sampling artifact?
ARM has dedicated register banks for several interrupt levels for exactly this reason. Simple interrupt handlers can operate in these without spilling *any* userspace registers. This gives ARM quite good interrupt latency, especially in the simpler implementations.
That doesn’t help for an actual context switch of course. What does help is “lazy FPU state switching”, where on a context switch the FPU is simply marked as unavailable. Only if/when the process attempts to *use* the FPU, this gets trapped and the trap handler restores the correct state before returning an enabled FPU to userspace. The same goes for SIMD register banks, of course.
Lazy context switching is a kernel feature. It’s used on all architectures that have a runtime disable-able FPU, AFAIK. For a context switch to kernel and back to the same process, the FPU & SIMD are never actually switched, so there is almost no overhead.
- Jonathan Morton
prev parent reply other threads:[~2016-01-06 6:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 6:37 Jonathan Morton
2016-01-05 17:42 ` Aaron Wood
2016-01-05 18:27 ` Jonathan Morton
2016-01-05 18:57 ` Dave Täht
2016-01-05 19:29 ` Steinar H. Gunderson
2016-01-05 19:37 ` Dave Täht
2016-01-05 20:13 ` David Collier-Brown
2016-01-05 20:27 ` Stephen Hemminger
2016-01-05 21:10 ` Jonathan Morton
2016-01-05 23:20 ` Steinar H. Gunderson
2016-01-05 23:17 ` Steinar H. Gunderson
2016-01-05 21:36 ` Benjamin Cronce
2016-01-06 0:01 ` Steinar H. Gunderson
2016-01-06 0:06 ` Stephen Hemminger
2016-01-06 0:22 ` Steinar H. Gunderson
2016-01-06 0:53 ` Stephen Hemminger
2016-01-06 0:55 ` Steinar H. Gunderson
2016-01-06 1:22 ` Stephen Hemminger
2016-01-06 6:18 ` Jonathan Morton [this message]
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
List information: https://lists.bufferbloat.net/postorius/lists/bloat.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1AAED798-A2DC-4D90-B51A-7414930C3C21@gmail.com \
--to=chromatix99@gmail.com \
--cc=bloat@lists.bufferbloat.net \
--cc=sgunderson@bigfoot.com \
--cc=stephen@networkplumber.org \
/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