[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] what happens when a PoD page is touched?


  • To: James Harper <james.harper@xxxxxxxxxxxxxxxx>
  • From: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
  • Date: Tue, 17 May 2011 14:00:47 +0100
  • Cc: Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>, Paul Durrant <Paul.Durrant@xxxxxxxxxx>, xen devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 17 May 2011 06:03:22 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=kh18BwAZJgivPZhRYNp30INJ63S1/ObGgmxLX/ZVoPbbtdlZ2mKh690rz9VpKtCV11 W4llrbK2dZpCO1VUHvbsoobWpudgnopGIq0BY2ZO1zYg9yNOEIYRnQ8MKXgOxfGVeXWv YLU7s4E0oIq9bEz1E0NysUnNx/wGv9wRmt46g=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

On Tue, May 17, 2011 at 10:37 AM, James Harper
<james.harper@xxxxxxxxxxxxxxxx> wrote:
> I still can't quite get my head around why this happens at all... I
> thought it would go like this:
>
> 1. Allocate 1MB of memory
> 2. Still under our limit so xen populates the pages when Windows clears
> them
> 3. Hand them back to xen
> 4. Repeat
>
> I'm doing that in a tight loop very early in boot. If I keep handing
> back pages (and thus reducing my populated page count) why am I hitting
> any PoD limit at all and invoking the page scavenging code? Windows
> isn't doing anything else at this point, and even if it was, I'm the
> boot driver so it has to wait for me before the boot can progress so
> it's not like it would be consuming gigabytes of memory.

Suppose for simplicity we're using 1G pages and not splintering them.

Suppose we boot a VM with 8G maxmem, 4G memory.

* Domain built
pages 0-7 are PoD, 4 pages in PoD pool.

* HVMLoader loaded into memory
Page 0 populated; 1-7 PoD, 3 pages in PoD pool

* Windows boots, starts scrubbing (from top of memory)
 + page 7 populated, 2 pages in PoD pool.
 + Page 6 populated, 1 page in PoD pool
 + Page 5 populated, 0 pages in PoD pool
 + Page 4 touched
  - emergency sweep marks page 7 PoD; page 4 populated
 + Page 3 touched
  - emergency sweep marks page 6 PoD; page 3 populated
 etc
 + page 1 touched
  - emergency sweep marks page 5 PoD; page 1 populated
 + Result at the end: pages 0-4 populated, 5-7 PoD, no pages in PoD pool


* Balloon driver starts.
 Let's suppose Windows happens to do all allocation from the PoD region.
 + Asks windows for 1 page
  - Windows chooses page 6, scrubs it.
  - emergency sweep marks page 4 PoD, populates page 6
  - Balloon driver hands page 6 back to Xen
  - page 5 marked empty; page put in PoD pool
 + Asks Windows for 1 more page
  - Windows chooses page 5, scrubs it.
  - Xen fills page 5 with the page in the PoD pool; PoD now empty
  - Balloon driver hands page 5 back to Xen
  - page 5 marked empty; page put in PoD pool
 + Repeat previous

So in theory, once you get your initial allocation from Windows, you
shouldn't have to do any sweeps.

The exception to this would be the case where you're allocating N
pages, where N > (used_pages - total allocation).

I guess try allocating fewer pages before returning them to Xen, and
seeing if that helps at all.

Hmm -- looks like I didn't upstream my PoD tracing patch, otherwise we
could see what was going on.  If you're interested in taking a look at
what's happening at a PoD level, I can try to dig it up and send it to
you.  (Probably need some porting because of the p2m restructuring Tim
Deegan has been doing.)

Peace,
 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.