[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/hvm/dm.c
> +++ b/xen/arch/x86/hvm/dm.c
> @@ -411,14 +411,17 @@ static int dm_op(domid_t domid,
>              while ( read_atomic(&p2m->ioreq.entry_count) &&
>                      first_gfn <= p2m->max_mapped_pfn )
>              {
> +                bool changed = false;
> +
>                  /* Iterate p2m table for 256 gfns each time. */
>                  p2m_finish_type_change(d, _gfn(first_gfn), 256,
> -                                       p2m_ioreq_server, p2m_ram_rw);
> +                                       p2m_ioreq_server, p2m_ram_rw, 
> &changed);
>  
>                  first_gfn += 256;
>  
>                  /* Check for continuation if it's not the last iteration. */
>                  if ( first_gfn <= p2m->max_mapped_pfn &&
> +                     changed &&
>                       hypercall_preempt_check() )
>                  {
>                      rc = -ERESTART;

I appreciate and support the intention, but you're opening up a
long lasting loop here in case very little or no changes need to
be done. You need to check for preemption every so many
iterations even if you've never seen "changed" come back set.

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