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

Re: [Xen-devel] [PATCH RFC] x86/ioreq server: Optimize p2m cleaning up code in p2m_finish_type_change().



>>> On 05.04.17 at 10:59, <yu.c.zhang@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1034,12 +1034,13 @@ void p2m_change_type_range(struct domain *d,
>  /* Synchronously modify the p2m type for a range of gfns from ot to nt. */
>  void p2m_finish_type_change(struct domain *d,
>                              gfn_t first_gfn, unsigned long max_nr,
> -                            p2m_type_t ot, p2m_type_t nt)
> +                            p2m_type_t ot, p2m_type_t nt, bool *changed)
>  {
>      struct p2m_domain *p2m = p2m_get_hostp2m(d);
>      p2m_type_t t;
>      unsigned long gfn = gfn_x(first_gfn);
>      unsigned long last_gfn = gfn + max_nr - 1;
> +    bool is_changed = false;
>  
>      ASSERT(ot != nt);
>      ASSERT(p2m_is_changeable(ot) && p2m_is_changeable(nt));
> @@ -1052,12 +1053,18 @@ void p2m_finish_type_change(struct domain *d,
>          get_gfn_query_unlocked(d, gfn, &t);
>  
>          if ( t == ot )
> +        {
>              p2m_change_type_one(d, gfn, t, nt);
> +            is_changed = true;
> +        }
>  
>          gfn++;
>      }
>  
>      p2m_unlock(p2m);
> +
> +    if ( changed )
> +        *changed = is_changed;
>  }

Also, wouldn't it be better to return a count here? If there was just
a single change in the current 256-GFN batch, surely we could take
on another?

Jan


_______________________________________________
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®.