On 05.11.2020 16:55, Jan Beulich wrote:
> This array can be large when many grant frames are permitted; avoid
> allocating it when it's not going to be used anyway. Do so indirectly
> though, by making grant_to_status_frames() return zero in this case.
> 
> Signed-off-by: Jan Beulich <jbeul...@suse.com>

Ping?

> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -446,11 +446,14 @@ static inline void active_entry_release(
>  
>  static inline unsigned int grant_to_status_frames(unsigned int grant_frames)
>  {
> +    if ( opt_gnttab_max_version < 2 )
> +        return 0;
>      return DIV_ROUND_UP(grant_frames * GRANT_PER_PAGE, 
> GRANT_STATUS_PER_PAGE);
>  }
>  
>  static inline unsigned int status_to_grant_frames(unsigned int status_frames)
>  {
> +    ASSERT(opt_gnttab_max_version >= 2);
>      return DIV_ROUND_UP(status_frames * GRANT_STATUS_PER_PAGE, 
> GRANT_PER_PAGE);
>  }
>  
> 


Reply via email to