From: George Dunlap <george.dunlap@citrix.com>
To: Tim Deegan <Tim.Deegan@eu.citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 1 of 4] p2m: Keep statistics on order of p2m entries
Date: Fri, 6 May 2011 16:07:52 +0100 [thread overview]
Message-ID: <1304694472.25185.34.camel@elijah> (raw)
In-Reply-To: <20110506142358.GE24068@whitby.uk.xensource.com>
On Fri, 2011-05-06 at 15:23 +0100, Tim Deegan wrote:
> Hi,
>
> Can you please add this:
>
> [diff]
> showfunc = True
Ah, very helpful.
> There are two places where this patch changes the control flow of p2m
> operations:
Oops -- yeah, those definitely need some comments.
The "*_free_entry()" functions are used when replacing smaller-order
pages with a larger-order page. Most commonly this is replacing a bunch
of 4k pages with a 2MiB page, but in theory you could be replacing a
tree of mixed 4k and 2MiB pages with a 1G page as well.
When that happens, we also need to adjust the p2m order stats by:
* Decrementing stats on all the leaf entries being replaced
* Incrementing the stat for the new leaf entry.
Incrementing the stat for the new entry is done when the new entry is
assigned. Decrementing stats requires walking the old p2m tables and
finding valid leaf entries. Since *_free_entry() already do that, we
just piggyback.
p2m entries are already checked at the entrance to the function to see
if we're at a leaf. The patch adds appropriate reference counting if it
is.
The other change is how far down the tree *_free_entry() functions go.
Since their original purpose was only freeing intermediate tables, they
don't bother to walk all the way down to l0. Since we want to do
reference counting of the l0s as well, we just make it go all the way
down.
This does mean making a function call for all 512 entries of the L1
table, but it should be a pretty rare operation. I could refactor the
function to do the check before making the call instead, if desired.
Let me know if you want me to include this description in a new patch
series.
-George
>
> > @@ -167,11 +169,14 @@
> > void ept_free_entry(struct p2m_domain *p2m, ept_entry_t *ept_entry, int level)
> > {
> > /* End if the entry is a leaf entry. */
> > - if ( level == 0 || !is_epte_present(ept_entry) ||
> > - is_epte_superpage(ept_entry) )
> > + if ( level == 0 || !is_epte_present(ept_entry) || is_epte_superpage(ept_entry) )
> > + {
> > + if ( is_epte_countable(ept_entry) )
> > + p2m->stats.entries[level]--;
> > return;
> > + }
> >
> > - if ( level > 1 )
> > + if ( level > 0 )
> > {
>
> and similarly:
>
> > @@ -184,11 +184,15 @@
> > {
> > /* End if the entry is a leaf entry. */
> > if ( page_order == 0
> > - || !(l1e_get_flags(*p2m_entry) & _PAGE_PRESENT)
> > + || !(l1e_get_flags(*p2m_entry) & _PAGE_PRESENT)
> > || (l1e_get_flags(*p2m_entry) & _PAGE_PSE) )
> > + {
> > + if ( l1e_get_flags(*p2m_entry) )
> > + p2m->stats.entries[page_order/9]--;
> > return;
> > -
> > - if ( page_order > 9 )
> > + }
> > +
> > + if ( page_order )
>
> here. Can you explain those in a bit more detail?
>
> Cheers,
>
> Tim.
>
next prev parent reply other threads:[~2011-05-06 15:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 14:01 [PATCH 0 of 4] Use superpages on restore/migrate George Dunlap
2011-05-06 14:01 ` [PATCH 1 of 4] p2m: Keep statistics on order of p2m entries George Dunlap
2011-05-06 14:23 ` Tim Deegan
2011-05-06 15:07 ` George Dunlap [this message]
2011-05-06 14:40 ` Christoph Egger
2011-05-06 15:00 ` Tim Deegan
2011-05-06 14:53 ` Christoph Egger
2011-05-06 15:34 ` George Dunlap
2011-05-09 8:27 ` Tim Deegan
2012-06-08 10:52 ` George Dunlap
2012-06-14 8:52 ` Tim Deegan
2011-05-06 15:14 ` George Dunlap
2011-05-06 14:01 ` [PATCH 2 of 4] tools: Detect superpages on domain restore George Dunlap
2011-05-06 14:01 ` [PATCH 3 of 4] tools: Save superpages in the same batch, to make detection easier George Dunlap
2011-05-06 14:01 ` [PATCH 4 of 4] tools: Introduce "allocate-only" page type for migration George Dunlap
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=1304694472.25185.34.camel@elijah \
--to=george.dunlap@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=Tim.Deegan@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.