public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "Tony Luck" <tony.luck@intel.com>
Cc: discuss@x86-64.org, linux-kernel@vger.kernel.org,
	libc-alpha@sourceware.org, vojtech@suse.cz
Subject: Re: FOR REVIEW: New x86-64 vsyscall vgetcpu()
Date: Fri, 16 Jun 2006 08:22:23 +0200	[thread overview]
Message-ID: <200606160822.23898.ak@suse.de> (raw)
In-Reply-To: <12c511ca0606151144i140c21e5w90dd948af9b536a4@mail.gmail.com>

On Thursday 15 June 2006 20:44, Tony Luck wrote:
> On 6/14/06, Andi Kleen <ak@suse.de> wrote:
> > But at a closer look it really makes sense:
> > - The kernel has strong thread affinity and usually keeps a process on the
> > same CPU. So switching CPUs is rare. This makes it an useful optimization.
> 
> Alternatively it means that this will almost always do the right thing, but
> once in a while it won't, your application will happen to have been migrated
> to a different cpu/node at the point it makes the call, and from then on
> this instance will behave oddly (running slowly because it allocates most
> of its memory on the wrong node).  When you try to reproduce the problem,
> the application will work normally.

That's inherent in NUMA. No good way around that.

We have a similar problem with caches because we don't color them. People
have learned to live with it.
 
> > The alternative is usually to bind the process to a specific CPU - then it
> > "know" where it is - but the problem is that this is nasty to use and
> > requires user configuration. The kernel often can make better decisions on
> > where to schedule. And doing it automatically makes it just work.
> 
> Another alternative would be to provide a mechanism for a process
> to bind to the current cpu (whatever cpu that happens to be).  Then
> the kernel gets to make the smart placement decisions, and processes
> that want to be bound somewhere (but don't really care exactly where)
> have a way to meet their need.  Perhaps a cpumask of all zeroes to a
> sched_setaffinity call could be overloaded for this?

I tried something like this a few years ago and it just didn't work
(or rather ran usually slower) The scheduler would select a home node at startup and 
then try to move the process there. 

The problem is that not using a CPU costs you much more than whatever
overhead you get from using non local memory.

So by default filling the CPUs must be the highest priority and memory 
policy cannot interfere with that.
 
-Andi

  reply	other threads:[~2006-06-16  6:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-14  7:42 FOR REVIEW: New x86-64 vsyscall vgetcpu() Andi Kleen
2006-06-14 10:47 ` Alan Cox
2006-06-14 14:54 ` Steve Munroe
2006-06-15 23:17   ` Benjamin Herrenschmidt
     [not found] ` <449029DB.7030505@redhat.com>
     [not found]   ` <200606141752.02361.ak@suse.de>
2006-06-14 16:30     ` Ulrich Drepper
2006-06-14 17:34       ` [discuss] " Andi Kleen
2006-06-15 18:44 ` Tony Luck
2006-06-16  6:22   ` Andi Kleen [this message]
2006-06-16  7:23     ` Gerd Hoffmann
2006-06-16  7:37       ` Andi Kleen
2006-06-16  9:48     ` Jes Sorensen
2006-06-16 10:09       ` Andi Kleen
2006-06-16 11:02         ` Jes Sorensen
2006-06-16 11:17           ` Andi Kleen
2006-06-16 11:58             ` Jes Sorensen
2006-06-16 12:36               ` Zoltan Menyhart
2006-06-16 12:41                 ` Jes Sorensen
2006-06-16 12:48                   ` Zoltan Menyhart
2006-06-16 21:04                     ` Chase Venters
2006-06-16 14:56                 ` Andi Kleen
2006-06-16 15:31                   ` Zoltan Menyhart
2006-06-16 15:37                     ` Andi Kleen
2006-06-16 15:58                       ` Jakub Jelinek
2006-06-16 16:24                         ` Andi Kleen
2006-06-16 16:33                           ` Jakub Jelinek
2006-06-16 21:12                     ` Chase Venters
2006-06-16 15:36                   ` Brent Casavant
2006-06-16 15:40                     ` Andi Kleen
2006-06-16 21:15                       ` Chase Venters
2006-06-16 21:19                       ` Chase Venters
2006-06-16 23:40                         ` Brent Casavant
2006-06-17  6:58                           ` Andi Kleen
2006-06-17  6:55                         ` [discuss] " Andi Kleen
2006-06-19  8:42                           ` Zoltan Menyhart
2006-06-19  8:54                             ` Andi Kleen
2006-06-16 14:54               ` Andi Kleen
2006-06-20  8:28                 ` Jes Sorensen
2006-06-19  0:15 ` Paul Jackson
2006-06-19  8:21   ` Andi Kleen
2006-06-19 10:09     ` Paul Jackson
2006-06-21  1:18     ` Paul Jackson
2006-06-21  1:21       ` Paul Jackson

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=200606160822.23898.ak@suse.de \
    --to=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=vojtech@suse.cz \
    /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