mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Chuck Ebbert <cebbert@redhat.com>,
	Roland McGrath <roland@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH x86/mm 6/6] x86-64 ia32 ptrace get/putreg32 current task
Date: Thu, 29 Nov 2007 11:08:41 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.0.9999.0711291057320.8458@woody.linux-foundation.org> (raw)
In-Reply-To: <474F08E1.2090806@zytor.com>



On Thu, 29 Nov 2007, H. Peter Anvin wrote:
> Linus Torvalds wrote:
> > 
> > > It is advantageous for user space to use the register the kernel typically
> > > won't, in order to speed up system call entry/exit.
> > 
> > but I'm not seeing the reason for that one. Care to comment more? (Yes,
> > there is often a latency from segment reload to use, but the reload latency
> > for system call exit *should* be entirely covered by the cost of doing the
> > system call return itself, no?)
> 
> I do seem to recall that some processor implementations can load a NULL
> segment faster than a non-NULL segment.  This was significant enough that we
> wanted to use %fs in x86-64 userspace, as opposed to the original ABI which
> used %gs both in userspace and in the kernel.

Ahh, I think you may be right for some CPUs. The zero selector is indeed 
potentially faster to load, since it doesn't have to even bother looking 
at the GDT/LDT.

That said, I doubt it's very noticeable. I just ran tests on both an old 
P4 and on a more modern Core 2 machine, and for both of those the 
performance was identical between loading a NUL selector and loading it 
with a non-zero one.

But I could well imagine that it matters a few cycles on other CPU's. But 
from my testing, it definitely isn't noticeable, and I think the 
maintenance advantage of using the same segment setup would more than make 
up for the fact that maybe some odd CPU can see a difference.

			Linus

  reply	other threads:[~2007-11-29 19:10 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29  0:38 [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Roland McGrath
2007-11-29  0:40 ` [PATCH x86/mm 2/6] x86-64 ptrace whitespace Roland McGrath
2007-11-29  0:40 ` [PATCH x86/mm 3/6] x86-32 " Roland McGrath
2007-11-29  0:41 ` [PATCH x86/mm 4/6] x86-64 ptrace get/putreg current task Roland McGrath
2007-11-29 17:39   ` Christoph Hellwig
2007-11-29  0:42 ` [PATCH x86/mm 5/6] x86-32 " Roland McGrath
2007-11-29  0:42 ` [PATCH x86/mm 6/6] x86-64 ia32 ptrace get/putreg32 " Roland McGrath
2007-11-29 17:34   ` Chuck Ebbert
2007-11-29 18:09     ` Linus Torvalds
2007-11-29 18:16       ` H. Peter Anvin
2007-11-29 18:31         ` Linus Torvalds
2007-11-29 18:45           ` H. Peter Anvin
2007-11-29 19:08             ` Linus Torvalds [this message]
2007-11-29 19:16               ` H. Peter Anvin
2007-11-29 19:27                 ` Andi Kleen
2007-11-29 19:44                   ` Ingo Molnar
2007-11-29 20:01                     ` H. Peter Anvin
2007-12-01 23:44                     ` Jeremy Fitzhardinge
2007-11-29 19:49                   ` Linus Torvalds
2007-11-29 20:11                     ` Andi Kleen
2007-11-29 20:23                       ` Linus Torvalds
2007-11-29 18:17       ` Chuck Ebbert
2007-11-29 18:23         ` H. Peter Anvin
2007-11-29 22:25       ` Roland McGrath
2007-11-29 22:34         ` Linus Torvalds
2007-11-29 22:21     ` Roland McGrath
2007-11-29 23:00       ` Chuck Ebbert
2007-11-29 10:39 ` [PATCH x86/mm 1/6] x86-64 ia32 ptrace pt_regs cleanup Ingo Molnar

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=alpine.LFD.0.9999.0711291057320.8458@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=cebbert@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.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

all inboxes | Powered by JetHome®