public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: 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 23:50:17 +0200	[thread overview]
Message-ID: <49330A99.6080801@redhat.com> (raw)
In-Reply-To: <20081130214111.GA6703@one.firstfloor.org>

Andi Kleen wrote:
> On Sun, Nov 30, 2008 at 10:07:01PM +0200, Avi Kivity wrote:
>   
>> Right.  Allocated from the guest kernel's perspective.  This may be 
>> different from the host kernel's perspective.
>>
>> Linux will delay touching memory until the last moment, Windows will not 
>> (likely it zeros pages on their own nodes, but who knows)?
>>     
>
> The problem on Linux is that the first touch is clear_page() and 
> that unfortunately happens in the direct mapping before mapping, 
> so the "detect mapping" trick doesn't quite work (unless it's a 32bit highmem 
> page). 
>   

It should still be on the same cpu.

> Ok one could migrate it on mapping. When the data is still cache
> hot that shouldn't be that expensive. Thinking about it again 
> it might be actually a reasonable approach.
>
>   

Could also work for normal apps - move code and data to local node.

But again, we don't have any guest mapping information when we're 
running under #pt; only the first access.  If we're willing so sacrifice 
memory, we can get the first access per virtual node.

>> In our case, the application is the guest kernel, which does know.
>>     
>
> It knows but it doesn't really care all that much.  The only thing
> that counts is the end performance in this case.
>   

Well, testing is the only way to know.  I'm particularly interested in 
how Windows will perform, since we know so little about its internals.

 From some light googling, it looks like Windows has a home node for a 
thread, and will allocate pages from the home node even when the thread 
is executing on some other node temporarily.  It also does automatic 
page migration in some cases.


>> The difference is, Linux (as a guest) will try to reuse freed pages from 
>> an application or pagecache, knowing which node they belong to.
>>
>> I agree that if all you do is HPC style computation (boot a kernel and 
>> one app with one process per cpu), then the heuristics work well.
>>     
>
> Or if there's a way to detect unmapping/remapping.
>   

Sure, if you're willing to drop %pt.

>>> It is certainly not perfect and has holes (like any heuristics),
>>> but it has the advantage of being fully dynamic. 
>>>  
>>>       
>> It also has the advantage of being already implemented (apart from fake 
>> SRAT tables; and that isn't necessary for HPC apps).
>>     
>
> What do you mean?
>   

Which part?  being already implemented?  Like I said earlier, right now 
kvm will allocate memory from the process that runs the vcpu that first 
touched this memory.  Given that Linux prefers allocating from the 
current node, we already implement the first touch heuristic.


-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


  reply	other threads:[~2008-11-30 21:50 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
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 [this message]
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=49330A99.6080801@redhat.com \
    --to=avi@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=andre.przywara@amd.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