x86/mem-sharing: don't pointlessly use get_domain_by_id()

For short-lived references rcu_lock_domain_by_id() is the better
(slightly cheaper) alternative.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Jan Beulich committed 2021-01-07 15:09:20 +01:00
1 parent 37c709a16f
commit 1977cd74ff
1 file changed
+4 -4
+4 -4
View File
@@ -537,7 +537,7 @@ static int audit(void)
p2m_type_t t;
mfn_t o_mfn;
d = get_domain_by_id(g->domain);
d = rcu_lock_domain_by_id(g->domain);
if ( d == NULL )
{
gdprintk(XENLOG_ERR,
@@ -562,7 +562,7 @@ static int audit(void)
d, g->gfn, mfn_x(mfn), p2m_ram_shared, t);
errors++;
}
put_domain(d);
rcu_unlock_domain(d);
nr_gfns++;
}
/* The type count has an extra ref because we have locked the page */
@@ -1043,10 +1043,10 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
rmap_del(gfn, cpage, 0);
rmap_add(gfn, spage);
put_count++;
d = get_domain_by_id(gfn->domain);
d = rcu_lock_domain_by_id(gfn->domain);
BUG_ON(!d);
BUG_ON(set_shared_p2m_entry(d, gfn->gfn, smfn));
put_domain(d);
rcu_unlock_domain(d);
}
ASSERT(list_empty(&cpage->sharing->gfns));
BUG_ON(!put_count);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.