From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Tamas K Lengyel <tamas@tklengyel.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH v5 1/2] x86/mem-sharing: Bulk mem-sharing entire domains
Date: Tue, 14 Jun 2016 12:33:34 -0400 [thread overview]
Message-ID: <20160614163334.GA11034@char.us.oracle.com> (raw)
In-Reply-To: <1465687481-10095-1-git-send-email-tamas@tklengyel.com>
> 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.
> + {
> + /*
> + * 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.
> + {
> + 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("..
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-14 16:33 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 [this message]
[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
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=20160614163334.GA11034@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=tamas@tklengyel.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).