xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Tamas K Lengyel <tamas@tklengyel.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v5 1/2] x86/mem-sharing: Bulk mem-sharing entire domains
Date: Tue, 14 Jun 2016 10:42:41 -0600	[thread overview]
Message-ID: <CABfawhmeEz+Gfbr=5OF3DgEK2MTkAxLvSY5iBpooQoM3sVQeMw@mail.gmail.com> (raw)
In-Reply-To: <CABfawhkTvytb7NvHJ-AHJBCxA3wJ5Fo-ciV66JpSY-xdK+3v5Q@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2875 bytes --]

On Jun 14, 2016 10:33, "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>
wrote:
>
> > diff --git a/xen/arch/x86/mm/mem_sharing.c
b/xen/arch/x86/mm/mem_sharing.c
> > index a522423..ba06fb0 100644
> > --- a/xen/arch/x86/mm/mem_sharing.c
> > +++ b/xen/arch/x86/mm/mem_sharing.c
> > @@ -1294,6 +1294,54 @@ int relinquish_shared_pages(struct domain *d)
> >      return rc;
> >  }
> >
> > +static int bulk_share(struct domain *d, struct domain *cd, unsigned
long limit,
> > +                      struct mem_sharing_op_bulk *bulk)
> > +{
> > +    int rc = 0;
> > +    shr_handle_t sh, ch;
> > +
> > +    while( limit > bulk->start )
>
> You are missing a space there.

Ack.

> > +    {
> > +        /*
> > +         * We only break out if we run out of memory as individual
pages may
> > +         * legitimately be unsharable and we just want to skip over
those.
> > +         */
> > +        rc = mem_sharing_nominate_page(d, bulk->start, 0, &sh);
> > +        if ( rc == -ENOMEM )
> > +            break;
> > +        if ( !rc )
> > +        {
> > +            rc = mem_sharing_nominate_page(cd, bulk->start, 0, &ch);
> > +            if ( rc == -ENOMEM )
> > +                break;
> > +            if ( !rc )
> > +            {
> > +                /* If we get here this should be guaranteed to
succeed. */
> > +                rc = mem_sharing_share_pages(d, bulk->start, sh,
> > +                                             cd, bulk->start, ch);
> > +                ASSERT(!rc);
> > +            }
> > +        }
> > +
> > +        /* Check for continuation if it's not the last iteration. */
> > +        if ( limit > ++bulk->start && hypercall_preempt_check() )
>
> I surprised the compiler didn't complain to you about lack of parenthesis.

This seems to be standard way to create continuation used in multiple
places throughout Xen. I don't personally like it much but I guess it's
better to be consistent.

>
> > +        {
> > +            rc = 1;
> > +            break;
> > +        }
> > +    }
> > +
> > +    /*
> > +     * We only propagate -ENOMEM as individual pages may fail with
-EINVAL,
> > +     * and for bulk sharing we only care if -ENOMEM was encountered so
we reset
> > +     * rc here.
> > +     */
> > +    if ( rc < 0 && rc != -ENOMEM )
> > +        rc = 0;
> > +
> > +    return rc;
> > +}
> > +
> >  int mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
> >  {
> >      int rc;
> > @@ -1468,6 +1516,79 @@ int
mem_sharing_memop(XEN_GUEST_HANDLE_PARAM(xen_mem_sharing_op_t) arg)
> >          }
> >          break;
> >
> > +        case XENMEM_sharing_op_bulk_share:
> > +        {
> > +            unsigned long max_sgfn, max_cgfn;
> > +            struct domain *cd;
> > +
> > +            rc = -EINVAL;
> > +            if( mso.u.bulk._pad[0] || mso.u.bulk._pad[1] ||
mso.u.bulk._pad[2] )
>
> The "if("..

Ack.

Thanks,
Tamas

[-- Attachment #1.2: Type: text/html, Size: 4225 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

  parent reply	other threads:[~2016-06-14 16:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11 23:24 [PATCH v5 1/2] x86/mem-sharing: Bulk mem-sharing entire domains Tamas K Lengyel
2016-06-11 23:24 ` [PATCH v5 2/2] tests/mem-sharing: Add bulk option to memshrtool Tamas K Lengyel
2016-06-12  0:08 ` [PATCH v5 1/2] x86/mem-sharing: Bulk mem-sharing entire domains Tamas K Lengyel
2016-06-14  9:56 ` Jan Beulich
2016-06-14 16:33 ` Konrad Rzeszutek Wilk
     [not found]   ` <CABfawhmqhAsEk=J5F3y0tAvd74xfi1_2-A+tfKzwCapcmL1zPg@mail.gmail.com>
     [not found]     ` <CABfawh=Hw-mZi+d751pRhA-C-wLOJ3TQPkW6rLAYp+GGGbxx1Q@mail.gmail.com>
     [not found]       ` <CABfawhnZVFt2Hwrfb+DNH3ft3gbB3Bc4+h7EpJfXbf=1_P-LWQ@mail.gmail.com>
     [not found]         ` <CABfawhkTvytb7NvHJ-AHJBCxA3wJ5Fo-ciV66JpSY-xdK+3v5Q@mail.gmail.com>
2016-06-14 16:42           ` Tamas K Lengyel [this message]
2016-06-15  8:14   ` Jan Beulich
2016-06-15 14:02     ` Konrad Rzeszutek Wilk
2016-06-22 15:38 ` George Dunlap
2016-06-23 15:42   ` Tamas K Lengyel
2016-07-05 14:35     ` George Dunlap
2016-07-05 14:58       ` Tamas K Lengyel
2016-07-05 14:59       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABfawhmeEz+Gfbr=5OF3DgEK2MTkAxLvSY5iBpooQoM3sVQeMw@mail.gmail.com' \
    --to=tamas@tklengyel.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).