From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>,
Ian Campbell <Ian.Campbell@citrix.com>,
Konrad Wilk <konrad.wilk@oracle.com>,
AndresLagar-Cavilla <andreslc@gridcentric.ca>,
Matthew Daley <mattjd@gmail.com>, TimDeegan <tim@xen.org>,
xen-devel@lists.xen.org, Zhigang Wang <zhigang.x.wang@oracle.com>
Subject: Re: [PATCH v7 1/2] hypervisor: XENMEM_claim_pages (subop of existing) hypercall
Date: Tue, 27 Nov 2012 15:12:59 -0800 (PST) [thread overview]
Message-ID: <1eddc947-d21e-4e2e-892f-c5d8dfd57e8b@default> (raw)
In-Reply-To: <50B48A2302000078000AB837@nat28.tlf.novell.com>
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Subject: Re: [PATCH v7 1/2] hypervisor: XENMEM_claim_pages (subop of existing) hypercall
>
> >>> On 26.11.12 at 19:11, Dan Magenheimer <dan.magenheimer@oracle.com> wrote:
> > +unsigned long domain_increase_tot_pages(struct domain *d, unsigned long pages)
> > +{
> > + long dom_before, dom_after, dom_claimed, sys_before, sys_after;
> > +
> > + ASSERT(spin_is_locked(&d->page_alloc_lock));
> > + if ( !d->unclaimed_pages )
> > + return d->tot_pages += pages;
>
> So after the conditional adjustment above, I fail to see where
> d->tot_pages would get adjusted in the code below. Which gets
> me to ask ...
Yep. Looks like I accidentally lost a line of code somewhere.
> > + spin_lock(&heap_lock);
> > + dom_before = d->unclaimed_pages;
> > + dom_after = dom_before - pages;
> > + if ( (dom_before > 0) && (dom_after < 0) )
> > + dom_claimed = 0;
> > + else
> > + dom_claimed = dom_after;
> > + sys_before = total_unclaimed_pages;
> > + sys_after = sys_before - (dom_before - dom_claimed);
> > + BUG_ON( (sys_before > 0) && (sys_after < 0) );
> > + total_unclaimed_pages = sys_after;
> > + d->unclaimed_pages = dom_claimed;
> > + spin_unlock(&heap_lock);
> > + return d->tot_pages;
> > +}
>
> ...: Is there actually a strong reason why there needs to be an
> "increase" and a "decrease" version of this, rather than just
> having an "adjust" operation with a signed page count
> parameter?
Good point. A good part of the logic seems different for the
two cases but the special cases in the increase case can
never occur in the decrease case and the additional checks
are harmless, so increase and decrease can be combined.
Spinning v8....
Thanks,
Dan
prev parent reply other threads:[~2012-11-27 23:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 18:11 [PATCH v7 1/2] hypervisor: XENMEM_claim_pages (subop of existing) hypercall Dan Magenheimer
2012-11-27 8:38 ` Jan Beulich
2012-11-27 23:12 ` Dan Magenheimer [this message]
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=1eddc947-d21e-4e2e-892f-c5d8dfd57e8b@default \
--to=dan.magenheimer@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=andreslc@gridcentric.ca \
--cc=keir@xen.org \
--cc=konrad.wilk@oracle.com \
--cc=mattjd@gmail.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
--cc=zhigang.x.wang@oracle.com \
/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).