From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: David Howells <dhowells@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] syscall latency improvement #1
Date: Fri, 25 Jan 2002 16:57:48 -0800 [thread overview]
Message-ID: <3C51FF0C.D3B1E2F7@zip.com.au> (raw)
In-Reply-To: <18993.1011984842@warthog.cambridge.redhat.com> <Pine.LNX.4.33.0201251626490.2042-100000@penguin.transmeta.com>
Linus Torvalds wrote:
>
> On Fri, 25 Jan 2002, David Howells wrote:
> >
> > * improves base syscall latency by approximately 5.4% (dual PIII) or 3.6%
> > (dual Athlon) as measured by lmbench's "lat_syscall null" command against
> > the vanilla kernel.
>
> Looking at the code, I suspect that 99.9% of this "improvement" comes from
> one thing, and one thing only: you removed the "cli" in the system call
> return path.
Before the cli was in the stock kernel, I had added it in the
low-latency patch. Careful testing showed that it added
13 machine cycles to a system call on a P3.
> ...
>
> - this "atomically return to user mode and test flags" thing needs to be
> discussed. I'm personally inclined to think that that "cli" is really
> needed, but 5% on simple system calls is a strong argument.
Correctness first, please. I bet there are many ways in
which we can speed the kernel up by more than 13*n_syscalls.
<thinks of one>
On Intel hardware an open-coded duff-device memcpy is faster
than copy_to_user for all alignments except mod32->mod32.
Sometimes up to 25% faster.
<thinks of another>
p = malloc(4096)
read(fd, p, 4096)
the kernel memsets the faulted-in page to zero and then
immediately copies the pagecache data onto it. Removal
of the memset speeds up read() by ~10%.
<thinks of another>
s/inline//g
<thinks of another>
ext[23] directory inode allocation policy (aargh
it's horrid)
<thinks of another>
page pre-zeroing in the idle thread.
There are many ways of speeding up the kernel. Let's
concentrate on the biggies.
> NOTE! There are potentially other ways to do all of this, _without_ losing
> atomicity. For example, you can move the "flags" value into the slot saved
> for the CS segment (which, modulo vm86, will always be at a constant
> offset on the stack), and make CS=0 be the work flag. That will cause the
> CPU to trap atomically at the "iret".
Ingo's low-latency patch put markers around the critical code section,
and inspected the return EIP on the way back out of the interrupt.
If it falls inside the racy region, do special stuff.
-
next prev parent reply other threads:[~2002-01-26 1:04 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-25 18:54 [PATCH] syscall latency improvement #1 David Howells
2002-01-25 22:35 ` Robert Love
2002-01-26 10:07 ` Nigel Gamble
2002-01-25 23:07 ` Paul Mackerras
2002-01-26 0:39 ` Linus Torvalds
2002-01-26 0:57 ` Andrew Morton [this message]
2002-01-26 1:20 ` Linus Torvalds
2002-01-26 4:00 ` Jamie Lokier
2002-01-28 14:18 ` Denis Vlasenko
2002-01-28 10:30 ` Andrew Morton
2002-01-28 15:28 ` Jeff Dike
2002-01-29 0:53 ` Rusty Russell
2002-01-29 12:54 ` Pavel Machek
2002-01-29 12:59 ` Denis Vlasenko
2002-02-21 7:10 ` Cameron Simpson
2002-01-26 18:39 ` [PATCH] " Alan Cox
2002-01-27 19:59 ` Jamie Lokier
[not found] <18993.1011984842@warthog.cambridge.redhat.com.suse.lists.linux.kernel>
[not found] ` <Pine.LNX.4.33.0201251626490.2042-100000@penguin.transmeta.com.suse.lists.linux.kernel>
2002-01-26 1:24 ` Andi Kleen
2002-01-26 1:53 ` Linus Torvalds
2002-01-26 2:03 ` Andi Kleen
2002-01-26 2:14 ` Linus Torvalds
2002-01-26 2:26 ` Andi Kleen
2002-01-26 2:39 ` Dave Jones
2002-01-26 2:53 ` Davide Libenzi
2002-01-26 2:10 ` Andrew Morton
2002-01-26 3:06 ` Robert Love
2002-01-26 3:20 ` Robert Love
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=3C51FF0C.D3B1E2F7@zip.com.au \
--to=akpm@zip.com.au \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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