public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Avi Kivity <avi@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Andre Przywara <andre.przywara@amd.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 0/3] KVM-userspace: add NUMA support for guests
Date: Sun, 30 Nov 2008 17:05:39 +0100	[thread overview]
Message-ID: <20081130160539.GV6703@one.firstfloor.org> (raw)
In-Reply-To: <4932B37A.3070305@redhat.com>

On Sun, Nov 30, 2008 at 05:38:34PM +0200, Avi Kivity wrote:
> Andi Kleen wrote:
> >>I don't think the first one works without the second.  Calling getcpu() 
> >>on startup is meaningless since the initial placement doesn't take the 
> >>    
> >
> >Who said anything about startup? The idea behind getcpu() is to call
> >it every time you allocate someting.
> >
> >  
> 
> Qemu only allocates on startup (though of course the kernel actually 
> allocates the memory lazily).

> Please explain.  When would you call getcpu() and what would you do at 
> that time?

When the guest allocates on the node of its current CPU get memory on
the node pool getcpu() tells you it is running on. More tricky 
is handling guest explicitely accessing other node for NUMA policy
purposes, but in this case you can access the cache of the getcpu
information of other vcpus. 

This is roughly equivalent of getting a fresh new demand fault page,
but doesn't require to unmap/free/remap.

The tricky bit is probably figuring out what is a fresh new page for
the guest. That might need some paravirtual help.

It's an approximate scheme, I don't know how well it would really
work. 

> >I think I would prefer to fix that in the kernel. user space will never
> >have the full picture.
> >  
> 
> On the other hand, getting everyone happy so this can get into the 
> kernel will be very difficult.  Many workloads will lose from this; 
> we're trying to balance both memory affinity and cpu balancing, and each 
> workload has a different tradeoff.

Yes it's unlikely to be a win in general, at least on small systems
with moderate NUMA factor. I expect KVM would need to turn it on with 
some explicit hints.

-Andi

-- 
ak@linux.intel.com

  reply	other threads:[~2008-11-30 15:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27 22:23 [PATCH 0/3] KVM-userspace: add NUMA support for guests Andre Przywara
2008-11-28  8:14 ` Andi Kleen
2008-11-29 18:43   ` Avi Kivity
2008-11-29 20:10     ` Andi Kleen
2008-11-29 20:35       ` Avi Kivity
2008-11-30 15:41         ` Andi Kleen
2008-11-30 15:38           ` Avi Kivity
2008-11-30 16:05             ` Andi Kleen [this message]
2008-11-30 16:38               ` Avi Kivity
2008-11-30 17:04                 ` Andi Kleen
2008-11-30 17:11                   ` Avi Kivity
2008-11-30 17:42                     ` Andi Kleen
2008-11-30 18:07                       ` Avi Kivity
2008-11-30 18:55                         ` Andi Kleen
2008-11-30 19:11                           ` Skywing
2008-11-30 20:08                             ` Avi Kivity
2008-11-30 20:07                           ` Avi Kivity
2008-11-30 21:41                             ` Andi Kleen
2008-11-30 21:50                               ` Avi Kivity
2008-11-30 22:08                                 ` Skywing
2008-11-28 10:40 ` Daniel P. Berrange
2008-11-29 18:29 ` Avi Kivity
2008-12-01 14:15   ` Andre Przywara
2008-12-01 14:29     ` Avi Kivity
2008-12-01 15:27       ` Anthony Liguori
2008-12-01 15:34         ` Anthony Liguori
2008-12-01 15:37         ` Avi Kivity
2008-12-01 15:49           ` Anthony Liguori
2008-12-01 14:44     ` Daniel P. Berrange
2008-12-01 14:53       ` Avi Kivity
2008-12-01 15:18 ` Anthony Liguori
2008-12-01 15:35   ` Avi Kivity

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=20081130160539.GV6703@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=andre.przywara@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.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