From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0
Date: Mon, 30 Sep 2013 13:06:12 +0100 [thread overview]
Message-ID: <1380542772-14335-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
If a slot has avail == 0 but still points to the right mfn, reuse it.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Changes in v2:
- check that the slot which we are about to reuse is valid.
---
xen/arch/arm/mm.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 44ec0e3..21e20fa 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -232,7 +232,15 @@ void *map_domain_page(unsigned long mfn)
i < DOMHEAP_ENTRIES;
slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
{
- if ( map[slot].pt.avail == 0 )
+ if ( map[slot].pt.avail < 0xf &&
+ map[slot].pt.base == slot_mfn &&
+ map[slot].pt.valid )
+ {
+ /* This slot already points to the right place; reuse it */
+ map[slot].pt.avail++;
+ break;
+ }
+ else if ( map[slot].pt.avail == 0 )
{
/* Commandeer this 2MB slot */
pte = mfn_to_xen_entry(slot_mfn);
@@ -240,12 +248,7 @@ void *map_domain_page(unsigned long mfn)
write_pte(map + slot, pte);
break;
}
- else if ( map[slot].pt.avail < 0xf && map[slot].pt.base == slot_mfn )
- {
- /* This slot already points to the right place; reuse it */
- map[slot].pt.avail++;
- break;
- }
+
}
/* If the map fills up, the callers have misbehaved. */
BUG_ON(i == DOMHEAP_ENTRIES);
--
1.7.2.5
next reply other threads:[~2013-09-30 12:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 12:06 Stefano Stabellini [this message]
2013-09-30 12:17 ` [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0 Tim Deegan
2013-10-03 13:38 ` Ian Campbell
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=1380542772-14335-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=tim@xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).