* [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0
@ 2013-09-30 12:06 Stefano Stabellini
2013-09-30 12:17 ` Tim Deegan
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2013-09-30 12:06 UTC (permalink / raw)
To: xen-devel; +Cc: tim, Ian.Campbell, stefano.stabellini
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0
2013-09-30 12:06 [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0 Stefano Stabellini
@ 2013-09-30 12:17 ` Tim Deegan
2013-10-03 13:38 ` Ian Campbell
0 siblings, 1 reply; 3+ messages in thread
From: Tim Deegan @ 2013-09-30 12:17 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: xen-devel, Ian.Campbell
At 13:06 +0100 on 30 Sep (1380546372), Stefano Stabellini wrote:
> 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>
Acked-by: Tim Deegan <tim@xen.org>
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0
2013-09-30 12:17 ` Tim Deegan
@ 2013-10-03 13:38 ` Ian Campbell
0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2013-10-03 13:38 UTC (permalink / raw)
To: Tim Deegan; +Cc: xen-devel, Stefano Stabellini
On Mon, 2013-09-30 at 13:17 +0100, Tim Deegan wrote:
> At 13:06 +0100 on 30 Sep (1380546372), Stefano Stabellini wrote:
> > 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>
>
> Acked-by: Tim Deegan <tim@xen.org>
Likewise, and applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-03 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 12:06 [PATCH v2 1/1] xen/arm: map_domain_page: reuse slots with avail == 0 Stefano Stabellini
2013-09-30 12:17 ` Tim Deegan
2013-10-03 13:38 ` Ian Campbell
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).