[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 5/7] gnttab: drop struct active_grant_entry's gfn field for release builds
This shrinks the size from 48 to 40 bytes bytes on 64-bit builds. Switch to gfn_t at once. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v2: Re-base. Use inline function instead of macro. Switch to gfn_t. --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -185,7 +185,9 @@ struct active_grant_entry { grant_ref_t trans_gref; struct domain *trans_domain; unsigned long frame; /* Frame being granted. */ - unsigned long gfn; /* Guest's idea of the frame being granted. */ +#ifndef NDEBUG + gfn_t gfn; /* Guest's idea of the frame being granted. */ +#endif spinlock_t lock; /* lock to protect access of this entry. see docs/misc/grant-tables.txt for locking protocol */ @@ -195,6 +197,13 @@ struct active_grant_entry { #define _active_entry(t, e) \ ((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE]) +static inline void act_set_gfn(struct active_grant_entry *act, gfn_t gfn) +{ +#ifndef NDEBUG + act->gfn = gfn; +#endif +} + DEFINE_PERCPU_RWLOCK_GLOBAL(grant_rwlock); static inline void gnttab_flush_tlb(const struct domain *d) @@ -891,7 +900,7 @@ map_grant_ref( op->flags & GNTMAP_readonly, rd); if ( rc != GNTST_okay ) goto unlock_out_clear; - act->gfn = gfn; + act_set_gfn(act, _gfn(gfn)); act->domid = ld->domain_id; act->frame = frame; act->start = 0; @@ -2287,7 +2296,7 @@ acquire_grant_for_copy( act->trans_domain = td; act->trans_gref = trans_gref; act->frame = grant_frame; - act->gfn = gfn_x(INVALID_GFN); + act_set_gfn(act, INVALID_GFN); /* * The actual remote remote grant may or may not be a sub-page, * but we always treat it as one because that blocks mappings of @@ -2313,7 +2322,7 @@ acquire_grant_for_copy( rc = get_paged_frame(gfn, &grant_frame, page, readonly, rd); if ( rc != GNTST_okay ) goto unlock_out_clear; - act->gfn = gfn; + act_set_gfn(act, _gfn(gfn)); is_sub_page = false; trans_page_off = 0; trans_length = PAGE_SIZE; @@ -2324,7 +2333,7 @@ acquire_grant_for_copy( readonly, rd); if ( rc != GNTST_okay ) goto unlock_out_clear; - act->gfn = sha2->full_page.frame; + act_set_gfn(act, _gfn(sha2->full_page.frame)); is_sub_page = false; trans_page_off = 0; trans_length = PAGE_SIZE; @@ -2335,7 +2344,7 @@ acquire_grant_for_copy( readonly, rd); if ( rc != GNTST_okay ) goto unlock_out_clear; - act->gfn = sha2->sub_page.frame; + act_set_gfn(act, _gfn(sha2->sub_page.frame)); is_sub_page = true; trans_page_off = sha2->sub_page.page_off; trans_length = sha2->sub_page.length; @@ -3500,8 +3509,16 @@ void grant_table_warn_active_grants(stru nr_active++; if ( nr_active <= WARN_GRANT_MAX ) - printk(XENLOG_G_DEBUG "Dom%d has an active grant: GFN: %lx (MFN: %lx)\n", - d->domain_id, act->gfn, act->frame); + printk(XENLOG_G_DEBUG "Dom%d has active grant %x (" +#ifndef NDEBUG + "GFN %lx, " +#endif + "MFN: %lx)\n", + d->domain_id, ref, +#ifndef NDEBUG + gfn_x(act->gfn), +#endif + act->frame); active_entry_release(act); } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |