[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 8/8] gnttab: drop struct active_grant_entry's gfn field for release builds



On 15/08/17 15:42, Jan Beulich wrote:
> This shrinks the size from 48 to 40 bytes bytes on 64-bit builds.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -185,7 +185,12 @@ struct active_grant_entry {
>      grant_ref_t   trans_gref;
>      struct domain *trans_domain;
>      unsigned long frame;  /* Frame being granted.                     */
> +#ifndef NDEBUG
>      unsigned long gfn;    /* Guest's idea of the frame being granted. */
> +# define act_set_gfn(act, val) ((act)->gfn = (val))
> +#else
> +# define act_set_gfn(act, gfn)
> +#endif
>      spinlock_t    lock;      /* lock to protect access of this entry.
>                                  see docs/misc/grant-tables.txt for
>                                  locking protocol                      */

IMO, this would be cleaner as

static void act_set_gfn(struct active_grant_entry *act, unsigned long gfn)
{
#ifndef NDEBUG
    act->gfn = gfn;
#endif
}

Which both moves the function out of the struct definition, and takes
care of side effect evaluation differences.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.