mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
xen/arm: map_domain_page: reuse slots with avail == 0
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> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
c1f3f1748d
commit
14cd36c23d
1 file changed
+10
-7
+10
-7
@@ -259,7 +259,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);
|
||||
@@ -267,12 +275,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);
|
||||
|
||||